目录 搜索
Scalable Vector Graphics (SVG) 1.1 (Second Edition) 1 Introduction 1.1 About SVG 1.2 SVG MIME type 1.3 SVG Namespace 1.4 Compatibility with Other Standards Efforts 1.5 Terminology 1.6 Definitions 2 Concepts 2.1 Explaining the name: SVG 2.2 Important SVG concepts 2.3 Options for using SVG in Web pages 3 Rendering Model 3.1 Introduction 3.2 The painters model 3.3 Rendering Order 3.4 How groups are rendered 3.5 How elements are rendered 3.6 Types of graphics elements 3.6.1 Painting shapes and text 3.6.2 Painting raster images 3.7 Filtering painted regions 3.8 Clipping 3.9 Parent Compositing 4 Basic Data Types and Interfaces 4.1 Syntax 4.2 Basic data types 4.3 Real number precision 4.4 Recognized color keyword names 4.5 Basic DOM interfaces 4.5.1 Interface SVGElement 4.5.2 Interface SVGAnimatedBoolean 4.5.3 Interface SVGAnimatedString 4.5.4 Interface SVGStringList 4.5.5 Interface SVGAnimatedEnumeration 4.5.6 Interface SVGAnimatedInteger 4.5.7 Interface SVGNumber 4.5.8 Interface SVGAnimatedNumber 4.5.9 Interface SVGNumberList 4.5.10 Interface SVGAnimatedNumberList 4.5.11 Interface SVGLength 4.5.12 Interface SVGAnimatedLength 4.5.13 Interface SVGLengthList 4.5.14 Interface SVGAnimatedLengthList 4.5.15 Interface SVGAngle 4.5.16 Interface SVGAnimatedAngle 4.5.17 Interface SVGColor 4.5.18 Interface SVGICCColor 4.5.19 Interface SVGRect 4.5.20 Interface SVGAnimatedRect 4.5.21 Interface SVGUnitTypes 4.5.22 Interface SVGStylable 4.5.23 Interface SVGLocatable 4.5.24 Interface SVGTransformable 4.5.25 Interface SVGTests 4.5.26 Interface SVGLangSpace 4.5.27 Interface SVGExternalResourcesRequired 4.5.28 Interface SVGFitToViewBox 4.5.29 Interface SVGZoomAndPan 4.5.30 Interface SVGViewSpec 4.5.31 Interface SVGURIReference 4.5.32 Interface SVGCSSRule 4.5.33 Interface SVGRenderingIntent 5 Document Structure 5.1 Defining an SVG document fragment: the 憇vg?element 5.1.1 Overview 5.1.2 The 憇vg?element 5.2 Grouping: the 慻?element 5.2.1 Overview 5.2.2 The 慻?element 5.3 Defining content for reuse 5.3.1 Overview 5.3.2 The 慸efs?element 5.4 The 慸esc?and 憈itle?elements 5.5 The 憇ymbol?element 5.6 The 憉se?element 5.7 The 慽mage?element 5.8 Conditional processing 5.8.1 Conditional processing overview 5.8.2 The 憇witch?element 5.8.3 The 憆equiredFeatures?attribute 5.8.4 The 憆equiredExtensions?attribute 5.8.5 The 憇ystemLanguage?attribute 5.8.6 Applicability of test attributes 5.9 Specifying whether external resources are required for proper rendering 5.10 Common attributes 5.10.1 Attributes common to all elements: 慽d?and 憍ml:base? 5.10.2 The 憍ml:lang?and 憍ml:space?attributes 5.11 DOM interfaces 5.11.1 Interface SVGDocument 5.11.2 Interface SVGSVGElement 5.11.3 Interface SVGGElement 5.11.4 Interface SVGDefsElement 5.11.5 Interface SVGDescElement 5.11.6 Interface SVGTitleElement 5.11.7 Interface SVGSymbolElement 5.11.8 Interface SVGUseElement 5.11.9 Interface SVGElementInstance 5.11.10 Interface SVGElementInstanceList 5.11.11 Interface SVGImageElement 5.11.12 Interface SVGSwitchElement 5.11.13 Interface GetSVGDocument 6 Styling 6.1 SVG's styling properties 6.2 Usage scenarios for styling 6.3 Alternative ways to specify styling properties 6.4 Specifying properties using the presentation attributes 6.5 Styling with XSL 6.6 Styling with CSS 6.7 Case sensitivity of property names and values 6.8 Facilities from CSS and XSL used by SVG 6.9 Referencing external style sheets 6.10 The 憇tyle?element 6.11 The 慶lass?attribute 6.12 The 憇tyle?attribute 6.13 Specifying the default style sheet language 6.14 Property inheritance 6.15 The scope/range of styles 6.16 User agent style sheet 6.17 Aural style sheets 6.18 DOM interfaces 6.18.1 Interface SVGStyleElement 7 Coordinate Systems 7.1 Introduction 7.2 The initial viewport 7.3 The initial coordinate system 7.4 Coordinate system transformations 7.5 Nested transformations 7.6 The 憈ransform?attribute 7.7 The 憊iewBox?attribute 7.8 The 憄reserveAspectRatio?attribute 7.9 Establishing a new viewport 7.10 Units 7.11 Object bounding box units 7.12 Intrinsic sizing properties of the viewport of SVG content 7.13 Geographic coordinate systems 7.14 The 憇vg:transform?attribute 7.15 DOM interfaces 7.15.1 Interface SVGPoint 7.15.2 Interface SVGPointList 7.15.3 Interface SVGMatrix 7.15.4 Interface SVGTransform 7.15.5 Interface SVGTransformList 7.15.6 Interface SVGAnimatedTransformList 7.15.7 Interface SVGPreserveAspectRatio 7.15.8 Interface SVGAnimatedPreserveAspectRatio 8 Paths 8.1 Introduction 8.2 The 憄ath?element 8.3 Path data 8.3.1 General information about path data 8.3.2 The "moveto" commands 8.3.3 The "closepath" command 8.3.4 The "lineto" commands 8.3.5 The curve commands 8.3.6 The cubic B閦ier curve commands 8.3.7 The quadratic B閦ier curve commands 8.3.8 The elliptical arc curve commands 8.3.9 The grammar for path data 8.4 Distance along a path 8.5 DOM interfaces 8.5.1 Interface SVGPathSeg 8.5.2 Interface SVGPathSegClosePath 8.5.3 Interface SVGPathSegMovetoAbs 8.5.4 Interface SVGPathSegMovetoRel 8.5.5 Interface SVGPathSegLinetoAbs 8.5.6 Interface SVGPathSegLinetoRel 8.5.7 Interface SVGPathSegCurvetoCubicAbs 8.5.8 Interface SVGPathSegCurvetoCubicRel 8.5.9 Interface SVGPathSegCurvetoQuadraticAbs 8.5.10 Interface SVGPathSegCurvetoQuadraticRel 8.5.11 Interface SVGPathSegArcAbs 8.5.12 Interface SVGPathSegArcRel 8.5.13 Interface SVGPathSegLinetoHorizontalAbs 8.5.14 Interface SVGPathSegLinetoHorizontalRel 8.5.15 Interface SVGPathSegLinetoVerticalAbs 8.5.16 Interface SVGPathSegLinetoVerticalRel 8.5.17 Interface SVGPathSegCurvetoCubicSmoothAbs 8.5.18 Interface SVGPathSegCurvetoCubicSmoothRel 8.5.19 Interface SVGPathSegCurvetoQuadraticSmoothAbs 8.5.20 Interface SVGPathSegCurvetoQuadraticSmoothRel 8.5.21 Interface SVGPathSegList 8.5.22 Interface SVGAnimatedPathData 8.5.23 Interface SVGPathElement 9 Basic Shapes 9.1 Introduction 9.2 The 憆ect?element 9.3 The 慶ircle?element 9.4 The 慹llipse?element 9.5 The 憀ine?element 9.6 The 憄olyline?element 9.7 The 憄olygon?element 9.7.1 The grammar for points specifications in 憄olyline?and 憄olygon?elements 9.8 DOM interfaces 9.8.1 Interface SVGRectElement 9.8.2 Interface SVGCircleElement 9.8.3 Interface SVGEllipseElement 9.8.4 Interface SVGLineElement 9.8.5 Interface SVGAnimatedPoints 9.8.6 Interface SVGPolylineElement 9.8.7 Interface SVGPolygonElement 10 Text 10.1 Introduction 10.2 Characters and their corresponding glyphs 10.3 Fonts 10.4 The 憈ext?element 10.5 The 憈span?element 10.6 The 憈ref?element 10.7 Text layout 10.7.1 Text layout introduction 10.7.2 Setting the inline-progression-direction 10.7.3 Glyph orientation within a text run 10.7.4 Relationship with bidirectionality 10.8 Text rendering order 10.9 Alignment properties 10.9.1 Text alignment properties 10.9.2 Baseline alignment properties 10.10 Font selection properties 10.11 Spacing properties 10.12 Text decoration 10.13 Text on a path 10.13.1 Introduction to text on a path 10.13.2 The 憈extPath?element 10.13.3 Text on a path layout rules 10.14 Alternate glyphs 10.14.1 The 慳ltGlyph?element 10.14.2 The 慳ltGlyphDef? 慳ltGlyphItem?and 慻lyphRef?elements 10.15 White space handling 10.16 Text selection and clipboard operations 10.17 DOM interfaces 10.17.1 Interface SVGTextContentElement 10.17.2 Interface SVGTextPositioningElement 10.17.3 Interface SVGTextElement 10.17.4 Interface SVGTSpanElement 10.17.5 Interface SVGTRefElement 10.17.6 Interface SVGTextPathElement 10.17.7 Interface SVGAltGlyphElement 10.17.8 Interface SVGAltGlyphDefElement 10.17.9 Interface SVGAltGlyphItemElement 10.17.10 Interface SVGGlyphRefElement 11 Painting: Filling 11.1 Introduction 11.2 Specifying paint 11.3 Fill Properties 11.4 Stroke Properties 11.5 Controlling visibility 11.6 Markers 11.6.1 Introduction 11.6.2 The 憁arker?element 11.6.3 Marker properties 11.6.4 Details on how markers are rendered 11.7 Rendering properties 11.7.1 Color interpolation properties: 慶olor-interpolation?and 慶olor-interpolation-filters? 11.7.2 The 慶olor-rendering?property 11.7.3 The 憇hape-rendering?property 11.7.4 The 憈ext-rendering?property 11.7.5 The 慽mage-rendering?property 11.8 Inheritance of painting properties 11.9 DOM interfaces 11.9.1 Interface SVGPaint 11.9.2 Interface SVGMarkerElement 12 Color 12.1 Introduction 12.2 The 慶olor?property 12.3 Color profile descriptions 12.3.1 Overview of color profile descriptions 12.3.2 Alternative ways of defining a color profile description 12.3.3 The 慶olor-profile?element 12.3.4 The CSS @color-profile rule 12.3.5 The 慶olor-profile?property 12.4 DOM interfaces 12.4.1 Interface SVGColorProfileElement 12.4.2 Interface SVGColorProfileRule 13 Gradients and Patterns 13.1 Introduction 13.2 Gradients 13.2.1 Introduction 13.2.2 Linear gradients 13.2.3 Radial gradients 13.2.4 Gradient stops 13.3 Patterns 13.4 DOM interfaces 13.4.1 Interface SVGGradientElement 13.4.2 Interface SVGLinearGradientElement 13.4.3 Interface SVGRadialGradientElement 13.4.4 Interface SVGStopElement 13.4.5 Interface SVGPatternElement 14 Clipping 14.1 Introduction 14.2 Simple alpha compositing 14.3 Clipping paths 14.3.1 Introduction 14.3.2 The initial clipping path 14.3.3 The 憃verflow?and 慶lip?properties 14.3.4 Clip to viewport vs. clip to 憊iewBox? 14.3.5 Establishing a new clipping path: the 慶lipPath?element 14.3.6 Clipping paths 14.4 Masking 14.5 Object and group opacity: the 憃pacity?property 14.6 DOM interfaces 14.6.1 Interface SVGClipPathElement 14.6.2 Interface SVGMaskElement 15 Filter Effects 15.1 Introduction 15.2 An example 15.3 The 慺ilter?element 15.4 The 慺ilter?property 15.5 Filter effects region 15.6 Accessing the background image 15.7 Filter primitives overview 15.7.1 Overview 15.7.2 Common attributes 15.7.3 Filter primitive subregion 15.8 Light source elements and properties 15.8.1 Introduction 15.8.2 Light source 慺eDistantLight? 15.8.3 Light source 慺ePointLight? 15.8.4 Light source 慺eSpotLight? 15.8.5 The 憀ighting-color?property 15.9 Filter primitive 慺eBlend? 15.10 Filter primitive 慺eColorMatrix? 15.11 Filter primitive 慺eComponentTransfer? 15.12 Filter primitive 慺eComposite? 15.13 Filter primitive 慺eConvolveMatrix? 15.14 Filter primitive 慺eDiffuseLighting? 15.15 Filter primitive 慺eDisplacementMap? 15.16 Filter primitive 慺eFlood? 15.17 Filter primitive 慺eGaussianBlur? 15.18 Filter primitive 慺eImage? 15.19 Filter primitive 慺eMerge? 15.20 Filter primitive 慺eMorphology? 15.21 Filter primitive 慺eOffset? 15.22 Filter primitive 慺eSpecularLighting? 15.23 Filter primitive 慺eTile? 15.24 Filter primitive 慺eTurbulence? 15.25 DOM interfaces 15.25.1 Interface SVGFilterElement 15.25.2 Interface SVGFilterPrimitiveStandardAttributes 15.25.3 Interface SVGFEBlendElement 15.25.4 Interface SVGFEColorMatrixElement 15.25.5 Interface SVGFEComponentTransferElement 15.25.6 Interface SVGComponentTransferFunctionElement 15.25.7 Interface SVGFEFuncRElement 15.25.8 Interface SVGFEFuncGElement 15.25.9 Interface SVGFEFuncBElement 15.25.10 Interface SVGFEFuncAElement 15.25.11 Interface SVGFECompositeElement 15.25.12 Interface SVGFEConvolveMatrixElement 15.25.13 Interface SVGFEDiffuseLightingElement 15.25.14 Interface SVGFEDistantLightElement 15.25.15 Interface SVGFEPointLightElement 15.25.16 Interface SVGFESpotLightElement 15.25.17 Interface SVGFEDisplacementMapElement 15.25.18 Interface SVGFEFloodElement 15.25.19 Interface SVGFEGaussianBlurElement 15.25.20 Interface SVGFEImageElement 15.25.21 Interface SVGFEMergeElement 15.25.22 Interface SVGFEMergeNodeElement 15.25.23 Interface SVGFEMorphologyElement 15.25.24 Interface SVGFEOffsetElement 15.25.25 Interface SVGFESpecularLightingElement 15.25.26 Interface SVGFETileElement 15.25.27 Interface SVGFETurbulenceElement 16 Interactivity 16.1 Introduction 16.2 Complete list of supported events 16.3 User interface events 16.4 Pointer events 16.5 Hit-testing and processing order for user interface events 16.5.1 Hit-testing 16.5.2 Event processing 16.6 The 憄ointer-events?property 16.7 Magnification and panning 16.8 Cursors 16.8.1 Introduction to cursors 16.8.2 The 慶ursor?property 16.8.3 The 慶ursor?element 16.9 DOM interfaces 16.9.1 Interface SVGCursorElement 17 Linking 17.1 References 17.1.1 Overview 17.1.2 IRIs and URIs 17.1.3 Syntactic forms: IRI and FuncIRI 17.1.4 Processing of IRI references 17.1.5 IRI reference attributes 17.2 Links out of SVG content: the 慳?element 17.3 Linking into SVG content: IRI fragments and SVG views 17.3.1 Introduction: IRI fragments and SVG views 17.3.2 SVG fragment identifiers 17.3.3 Predefined views: the 憊iew?element 17.3.4 Highlighting views 17.4 DOM interfaces 17.4.1 Interface SVGAElement 17.4.2 Interface SVGViewElement 18 Scripting 18.1 Specifying the scripting language 18.1.1 Specifying the default scripting language 18.1.2 Local declaration of a scripting language 18.2 The 憇cript?element 18.3 Event handling 18.4 Event attributes 18.4.1 Event attribute for the SVGLoad event 18.4.2 Event attributes on graphics and container elements 18.4.3 Document-level event attributes 18.4.4 Animation event attributes 18.5 DOM interfaces 18.5.1 Interface SVGScriptElement 18.5.2 Interface SVGZoomEvent 19 Animation 19.1 Introduction 19.2 Animation elements 19.2.1 Overview 19.2.2 Relationship to SMIL Animation 19.2.3 Animation elements example 19.2.4 Attributes to identify the target element for an animation 19.2.5 Attributes to identify the target attribute or property for an animation 19.2.6 Animation with namespaces 19.2.7 Paced animation and complex types 19.2.8 Attributes to control the timing of the animation 19.2.8.1 Clock values 19.2.9 Attributes that define animation values over time 19.2.10 Attributes that control whether animations are additive 19.2.11 Inheritance 19.2.12 The 慳nimate?element 19.2.13 The 憇et?element 19.2.14 The 慳nimateMotion?element 19.2.15 The 慳nimateColor?element 19.2.16 The 慳nimateTransform?element 19.2.17 Elements 19.3 Animation using the SVG DOM 19.4 DOM interfaces 19.4.1 Interface ElementTimeControl 19.4.2 Interface TimeEvent 19.4.3 Interface SVGAnimationElement 19.4.4 Interface SVGAnimateElement 19.4.5 Interface SVGSetElement 19.4.6 Interface SVGAnimateMotionElement 19.4.7 Interface SVGMPathElement 19.4.8 Interface SVGAnimateColorElement 19.4.9 Interface SVGAnimateTransformElement 20 Fonts 20.1 Introduction 20.2 Overview of SVG fonts 20.3 The 慺ont?element 20.4 The 慻lyph?element 20.5 The 憁issing-glyph?element 20.6 Glyph selection rules 20.7 The 慼kern?and 憊kern?elements 20.8 Describing a font 20.8.1 Overview of font descriptions 20.8.2 Alternative ways for providing a font description 20.8.3 The 慺ont-face?element 20.8.4 The 慺ont-face-src?element 20.8.5 The 慺ont-face-uri?and 慺ont-face-format?elements 20.8.6 The 慺ont-face-name?element 20.9 DOM interfaces 20.9.1 Interface SVGFontElement 20.9.2 Interface SVGGlyphElement 20.9.3 Interface SVGMissingGlyphElement 20.9.4 Interface SVGHKernElement 20.9.5 Interface SVGVKernElement 20.9.6 Interface SVGFontFaceElement 20.9.7 Interface SVGFontFaceSrcElement 20.9.8 Interface SVGFontFaceUriElement 20.9.9 Interface SVGFontFaceFormatElement 20.9.10 Interface SVGFontFaceNameElement 21 Metadata 21.1 Introduction 21.2 The 憁etadata?element 21.3 An example 21.4 DOM interfaces 21.4.1 Interface SVGMetadataElement 22 Backwards Compatibility 23 Extensibility 23.1 Foreign namespaces and private data 23.2 Embedding foreign object types 23.3 The 慺oreignObject?element 23.4 An example 23.5 Adding private elements and attributes to the DTD 23.6 DOM interfaces 23.6.1 Interface SVGForeignObjectElement Appendix A: Document Type Definition A.1 Introduction A.2 Modularization A.2.1 Element and attribute collections A.2.2 Profiling the SVG specification A.2.3 Practical considerations A.3 SVG 1.1 module definitions and DTD implementations A.3.1 Modular Framework Module A.3.2 Datatypes Module A.3.3 Qualified Name Module A.3.4 Core Attribute Module A.3.5 Container Attribute Module A.3.6 Viewport Attribute Module A.3.7 Paint Attribute Module A.3.8 Basic Paint Attribute Module A.3.9 Paint Opacity Attribute Module A.3.10 Graphics Attribute Module A.3.11 Basic Graphics Attribute Module A.3.12 Document Events Attribute Module A.3.13 Graphical Element Events Attribute Module A.3.14 Animation Events Attribute Module A.3.15 XLink Attribute Module A.3.16 External Resources Attribute Module A.3.17 Structure Module A.3.18 Basic Structure Module A.3.19 Conditional Processing Module A.3.20 Image Module A.3.21 Style Module A.3.22 Shape Module A.3.23 Text Module A.3.24 Basic Text Module A.3.25 Marker Module A.3.26 Color Profile Module A.3.27 Gradient Module A.3.28 Pattern Module A.3.29 Clip Module A.3.30 Basic Clip Module A.3.31 Mask Module A.3.32 Filter Module A.3.33 Basic Filter Module A.3.34 Cursor Module A.3.35 Hyperlinking Module A.3.36 View Module A.3.37 Scripting Module A.3.38 Animation Module A.3.39 Font Module A.3.40 Basic Font Module A.3.41 Extensibility Module A.4 SVG 1.1 Document Type Definition A.4.1 SVG 1.1 DTD Driver A.4.2 SVG 1.1 Document Model A.4.3 SVG 1.1 Attribute Collection Appendix B: SVG Document Object Model (DOM) B.1 SVG DOM overview B.1.1 SVG DOM object initialization B.2 Elements in the SVG DOM B.3 Naming conventions B.4 Exception SVGException B.5 Feature strings for the hasFeature method call B.6 Relationship with DOM Level 2 Events B.7 Relationship with DOM Level 2 CSS B.7.1 Introduction B.7.2 User agents that do not support styling with CSS B.7.3 User agents that support styling with CSS B.7.4 Extended interfaces B.8 Read only nodes in the DOM B.9 Invalid values Appendix C: IDL Definitions Appendix D: Java Language Binding D.1 The Java language binding D.2 Using SVG with the Java language Appendix E: ECMAScript Language Binding E.1 Exceptions E.2 Constants E.3 Types E.4 Objects Appendix F: Implementation Requirements F.1 Introduction F.2 Error processing F.3 Version control F.4 Clamping values which are restricted to a particular range F.5 憄ath?element implementation notes F.6 Elliptical arc implementation notes F.6.1 Elliptical arc syntax F.6.2 Out-of-range parameters F.6.3 Parameterization alternatives F.6.4 Conversion from center to endpoint parameterization F.6.5 Conversion from endpoint to center parameterization F.6.6 Correction of out-of-range radii F.7 Text selection implementation notes F.8 Printing implementation notes Appendix G: Conformance Criteria G.1 Introduction G.2 Conforming SVG Document Fragments G.3 Conforming SVG Stand-Alone Files G.4 Conforming SVG Generators G.5 Conforming SVG Servers G.6 Conforming SVG DOM Subtree G.7 Conforming SVG Interpreters G.8 Conforming SVG Viewers Appendix H: Accessibility Support H.1 WAI Accessibility Guidelines H.2 SVG Content Accessibility Guidelines Appendix I: Internationalization Support I.1 Introduction I.2 Internationalization and SVG I.3 SVG Internationalization Guidelines Appendix J: Minimizing SVG File Sizes Appendix K: References K.1 Normative references K.2 Informative references Appendix L: Element Index Appendix M: Attribute Index M.1 Regular attributes M.2 Presentation attributes Appendix N: Property Index Appendix O: Feature Strings O.1 Introduction O.2 SVG 1.1 feature strings O.3 SVG 1.0 feature strings Appendix P: Media Type Registration for image/svg+xml P.1 Introduction P.2 Registration of media type image/svg+xml Appendix Q: Changes Check Update
文字

SVG 1.1 (Second Edition) – 16 August 2011Top ⋅ Contents ⋅ Previous ⋅ Next ⋅ Elements ⋅ Attributes ⋅ Properties

4 Basic Data Types and Interfaces

Contents

  • 4.1 Syntax
  • 4.2 Basic data types
  • 4.3 Real number precision
  • 4.4 Recognized color keyword names
  • 4.5 Basic DOM interfaces
    • 4.5.1 Interface SVGElement
    • 4.5.2 Interface SVGAnimatedBoolean
    • 4.5.3 Interface SVGAnimatedString
    • 4.5.4 Interface SVGStringList
    • 4.5.5 Interface SVGAnimatedEnumeration
    • 4.5.6 Interface SVGAnimatedInteger
    • 4.5.7 Interface SVGNumber
    • 4.5.8 Interface SVGAnimatedNumber
    • 4.5.9 Interface SVGNumberList
    • 4.5.10 Interface SVGAnimatedNumberList
    • 4.5.11 Interface SVGLength
    • 4.5.12 Interface SVGAnimatedLength
    • 4.5.13 Interface SVGLengthList
    • 4.5.14 Interface SVGAnimatedLengthList
    • 4.5.15 Interface SVGAngle
    • 4.5.16 Interface SVGAnimatedAngle
    • 4.5.17 Interface SVGColor
    • 4.5.18 Interface SVGICCColor
    • 4.5.19 Interface SVGRect
    • 4.5.20 Interface SVGAnimatedRect
    • 4.5.21 Interface SVGUnitTypes
    • 4.5.22 Interface SVGStylable
    • 4.5.23 Interface SVGLocatable
    • 4.5.24 Interface SVGTransformable
    • 4.5.25 Interface SVGTests
    • 4.5.26 Interface SVGLangSpace
    • 4.5.27 Interface SVGExternalResourcesRequired
    • 4.5.28 Interface SVGFitToViewBox
    • 4.5.29 Interface SVGZoomAndPan
    • 4.5.30 Interface SVGViewSpec
    • 4.5.31 Interface SVGURIReference
    • 4.5.32 Interface SVGCSSRule
    • 4.5.33 Interface SVGRenderingIntent

4.1 Syntax

The EBNF grammar is as used in the XML specification, with the addition of ~, a case-insensitive literal: characters in the ASCII range (only) are declared to be case-insensitive. For example, ~"Hello" will match (H|h)(e|e)(l|L)(l|L)(o|O). This makes the productions much easier to read.

? optional, zero or one
+ one or more
* zero or more
| alternation
"string" literal
~"string" case-insensitive literal
[] a character range
[^] excluded character range
() grouping

4.2 Basic data types

This section defines a number of common data types used in the definitions of SVG properties and attributes. Some data types that are not referenced by multiple properties and attributes are defined inline in subsequent chapters.

Note that, as noted below, the specification of some types is different for CSS property values in style sheets (in the ‘style’ attribute, ‘style’ element or an external style sheet) than it is for for XML attribute values (including presentation attributes). This is due to restrictions in the CSS grammar. For example, scientific notation is allowed in attributes, including presentation attributes, but not in style sheets.

<angle>

Angles are specified in one of two ways depending upon whether they are used in CSS property syntax or SVG presentation attribute syntax:

  • When an <angle> is used in a style sheet or with a property in a ‘style’ attribute, the syntax must match the following pattern:

    angle ::= number (~"deg" | ~"grad" | ~"rad")?

    where deg indicates degrees, grad indicates grads and rad indicates radians. The unit identifier may be in lower (recommended) or upper case.

    For properties defined in CSS2 [CSS2], an angle unit identifier must be provided (for non-zero values). For SVG-specific properties the angle unit identifier is optional. If a unit is not provided, the angle value is assumed to be in degrees.

  • When an <angle> is used in an SVG presentation attribute, the syntax must match the following pattern:

    angle ::= number ("deg" | "grad" | "rad")?

    The unit identifier, if present, must be in lower case; if not present, the angle value is assumed to be in degrees.

In the SVG DOM, <angle> values are represented using SVGAngle or SVGAnimatedAngle objects.

<anything>

The basic type <anything> is a sequence of zero or more characters. Specifically:

anything ::= Char*

where Char is the production for a character, as defined in XML 1.0 ([XML10], section 2.2).

<color>

The basic type <color> is a CSS2 compatible specification for a color in the sRGB color space [SRGB]. <color> applies to SVG's use of the ‘color’ property and is a component of the definitions of properties ‘fill’, ‘stroke’, ‘stop-color’, ‘flood-color’ and ‘lighting-color’, which also offer optional ICC-based color specifications.

SVG supports all of the syntax alternatives for <color> defined in CSS2 syntax and basic data types ([CSS2], section 4.3.6), with the exception that SVG allows an expanded list of recognized color keywords names.

A <color> is either a keyword (see Recognized color keyword names) or a numerical RGB specification.

In addition to these color keywords, users may specify keywords that correspond to the colors used by objects in the user's environment. The normative definition of these keywords is found in User preferences for colors ([CSS2], section 18.2).

The format of an RGB value in hexadecimal notation is a "#" immediately followed by either three or six hexadecimal characters. The three-digit RGB notation (#rgb) is converted into six-digit form (#rrggbb) by replicating digits, not by adding zeros. For example, #fb0 expands to #ffbb00. This ensures that white (#ffffff) can be specified with the short notation (#fff) and removes any dependencies on the color depth of the display. The format of an RGB value in the functional notation is an RGB start-function followed by a comma-separated list of three numerical values (either three integer values or three percentage values) followed by ")". An RGB start-function is the case-insensitive string "rgb(", for example "RGB(" or "rGb(". For compatibility, the all-lowercase form "rgb(" is preferred. The integer value 255 corresponds to 100%, and to F or FF in the hexadecimal notation: rgb(255,255,255) = rgb(100%,100%,100%) = #FFF. White space characters are allowed around the numerical values. All RGB colors are specified in the sRGB color space [SRGB]. Using sRGB provides an unambiguous and objectively measurable definition of the color, which can be related to international standards (see [COLORIMETRY]).

color    ::= "#" hexdigit hexdigit hexdigit (hexdigit hexdigit hexdigit)?
             | "rgb(" wsp* integer comma integer comma integer wsp* ")"
             | "rgb(" wsp* integer "%" comma integer "%" comma integer "%" wsp* ")"
             | color-keyword
hexdigit ::= [0-9A-Fa-f]
comma    ::= wsp* "," wsp*
    

where color-keyword matches (case insensitively) one of the color keywords listed in Recognized color keyword names below, or one of the system color keywords listed in User preferences for colors ([CSS2], section 18.2).

The corresponding SVG DOM interface definitions for <color> are defined in Document Object Model CSS; in particular, see RGBColor ([DOM2STYLE], section 2.2). SVG's extension to color, including the ability to specify ICC-based colors, are represented using DOM interface SVGColor.

<coordinate>

A <coordinate> is a length in the user coordinate system that is the given distance from the origin of the user coordinate system along the relevant axis (the x-axis for X coordinates, the y-axis for Y coordinates). Its syntax is the same as that for <length>.

coordinate ::= length

Within the SVG DOM, a <coordinate> is represented as an SVGLength or an SVGAnimatedLength.

<frequency>

Frequency values are used with aural properties. As defined in CSS2, a frequency value is a <number> immediately followed by a frequency unit identifier. The frequency unit identifiers are:

  • Hz: Hertz
  • kHz: kilo Hertz

Frequency values may not be negative.

In the SVG DOM, <frequency> values are represented using the CSSPrimitiveValue interface defined in Document Object Model CSS ([DOM2STYLE], section 2.2).

<FuncIRI>
Functional notation for an IRI: "url(" <IRI> ")".
<icccolor>

An <icccolor> is an ICC color specification. In SVG 1.1, an ICC color specification is given by a name, which references a ‘color-profile’ element, and one or more color component values. The grammar is as follows:

icccolor ::= "icc-color(" name (comma-wsp number)+ ")"
name     ::= [^,()#x20#x9#xD#xA] /* any char except ",", "(", ")" or wsp */

The corresponding SVG DOM interface for <icccolor> is SVGICCColor.

<integer>

An <integer> is specified as an optional sign character ("+" or "-") followed by one or more digits "0" to "9":

integer ::= [+-]? [0-9]+

If the sign character is not present, the number is non-negative.

Unless stated otherwise for a particular attribute or property, the range for an <integer> encompasses (at a minimum) -2147483648 to 2147483647.

Within the SVG DOM, an <integer> is represented as a long or an SVGAnimatedInteger.

<IRI>

An Internationalized Resource Identifier (see IRI). For the specification of IRI references in SVG, see IRI references.

<length>

A length is a distance measurement, given as a number along with a unit which may be optional. Lengths are specified in one of two ways depending upon whether they are used in CSS property syntax or SVG presentation attribute syntax:

  • When a <length> is used in a style sheet or with a property in a ‘style’ attribute, the syntax must match the following pattern:

    length ::= number (~"em" | ~"ex" | ~"px" | ~"in" | ~"cm" | ~"mm" | ~"pt" | ~"pc")?

    See the CSS2 specification for the meanings of the unit identifiers. The unit identifier may be in lower (recommended) or upper case.

    For properties defined in CSS2 [CSS2], a length unit identifier must be provided (for non-zero values). For SVG-specific properties, the length unit identifier is optional. If a unit is not provided, the length value represents a distance in the current user coordinate system.

  • When a <length> is used in an SVG presentation attribute, the syntax must match the following pattern:

    length ::= number ("em" | "ex" | "px" | "in" | "cm" | "mm" | "pt" | "pc" | "%")?

    The unit identifier, if present, must be in lower case; if not present, the length value represents a distance in the current user coordinate system.

    Note that the non-property <length> definition also allows a percentage unit identifier. The meaning of a percentage length value depends on the attribute for which the percentage length value has been specified. Two common cases are: (a) when a percentage length value represents a percentage of the viewport width or height (refer to the section that discusses units in general), and (b) when a percentage length value represents a percentage of the bounding box width or height on a given object (refer to the section that describes object bounding box units).

In the SVG DOM, <length> values are represented using SVGLength or SVGAnimatedLength objects.

<list-of-family-names>

A <list-of-family-names> is a list of font family names using the same syntax as the ‘font-family’ property, excluding the <generic-family> and 'inherit' values.

<list-of-strings>

A <list-of-strings> consists of a separated sequence of <string>s. String lists are white space-separated, where white space is defined as one or more of the following consecutive characters: "space" (U+0020), "tab" (U+0009), "line feed" (U+000A) and "carriage return" (U+000D).

The following is an EBNF grammar describing the <list-of-strings> syntax:

list-of-strings ::= string
                    | string wsp list-of-strings
string          ::= [^#x9#xA#xD#x20]*
wsp             ::= [#x9#xA#xD#x20]+
<list-of-Ts>

(Where T is a type other than <string> and <family-name>.) A list consists of a separated sequence of values. Unless explicitly described differently, lists within SVG's XML attributes can be either comma-separated, with optional white space before or after the comma, or white space-separated.

White space in lists is defined as one or more of the following consecutive characters: "space" (U+0020), "tab" (U+0009), "line feed" (U+000A), "carriage return" (U+000D) and "form-feed" (U+000C).

The following is a template for an EBNF grammar describing the <list-of-Ts> syntax:

list-of-Ts ::= T
               | T comma-wsp list-of-Ts
comma-wsp  ::= (wsp+ ","? wsp*) | ("," wsp*)
wsp        ::= (#x20 | #x9 | #xD | #xA)

Within the SVG DOM, values of a <list-of-Ts> type are represented by an interface specific for the particular type T. For example, a <list-of-lengths> is represented in the SVG DOM using an SVGLengthList or SVGAnimatedLengthList object.

<name>

A name, which is a string where a few characters of syntactic significance are disallowed.

name  ::= [^,()#x20#x9#xD#xA] /* any char except ",", "(", ")" or wsp */
<number>

Real numbers are specified in one of two ways. When used in a style sheet, a <number> is defined as follows:

number ::= integer
           | [+-]? [0-9]* "." [0-9]+

This syntax is the same as the definition in CSS ([CSS2], section 4.3.1).

When used in an SVG attribute, a <number> is defined differently, to allow numbers with large magnitudes to be specified more concisely:

number ::= integer ([Ee] integer)?
           | [+-]? [0-9]* "." [0-9]+ ([Ee] integer)?

Within the SVG DOM, a <number> is represented as a float, SVGNumber or a SVGAnimatedNumber.

<number-optional-number>

A pair of <number>s, where the second <number> is optional.

number-optional-number ::= number
                           | number comma-wsp number

In the SVG DOM, a <number-optional-number> is represented using a pair of SVGAnimatedInteger or SVGAnimatedNumber objects.

<paint>

The values for properties ‘fill’ and ‘stroke’ are specifications of the type of paint to use when filling or stroking a given graphics element. The available options and syntax for <paint> are described in Specifying paint.

Within the SVG DOM, <paint> values are represented using SVGPaint objects.

<percentage>

Percentages are specified as a number followed by a "%" character:

percentage ::= number "%"

Note that the definition of <number> depends on whether the percentage is specified in a style sheet or in an attribute that is not also a presentation attribute.

Percentage values are always relative to another value, for example a length. Each attribute or property that allows percentages also defines the reference distance measurement to which the percentage refers.

Within the SVG DOM, a <percentage> is represented using an SVGNumber or SVGAnimatedNumber object.

<time>

A time value is a <number> immediately followed by a time unit identifier. The time unit identifiers are:

  • ms: milliseconds
  • s: seconds

In the SVG DOM, <time> values are represented using the CSSPrimitiveValue interface defined in Document Object Model CSS ([DOM2STYLE], section 2.2).

<transform-list>

A <transform-list> is used to specify a list of coordinate system transformations. A detailed description of the possible values for a <transform-list> is given in Modifying the User Coordinate System: the transform attribute.

Within the SVG DOM, a <transform-list> value is represented using an SVGTransformList or SVGAnimatedTransformList object.

<XML-Name>

An XML name, as defined by the Name production in Extensible Markup Language (XML) 1.0 ([XML10], section 2.3).

4.3 Real number precision

Unless stated otherwise for a particular attribute or property, a <number> has the capacity for at least a single-precision floating point number and has a range (at a minimum) of -3.4e+38F to +3.4e+38F.

It is recommended that higher precision floating point storage and computation be performed on operations such as coordinate system transformations to provide the best possible precision and to prevent round-off errors.

Conforming High-Quality SVG Viewers are required to use at least double-precision floating point for intermediate calculations on certain numerical operations.

4.4 Recognized color keyword names

The following is the list of recognized color keywords that can be used as a keyword value for data type <color>:

aliceblue rgb(240, 248, 255)
antiquewhite rgb(250, 235, 215)
aqua rgb( 0, 255, 255)
aquamarine rgb(127, 255, 212)
azure rgb(240, 255, 255)
beige rgb(245, 245, 220)
bisque rgb(255, 228, 196)
black rgb( 0, 0, 0)
blanchedalmond rgb(255, 235, 205)
blue rgb( 0, 0, 255)
blueviolet rgb(138, 43, 226)
brown rgb(165, 42, 42)
burlywood rgb(222, 184, 135)
cadetblue rgb( 95, 158, 160)
chartreuse rgb(127, 255, 0)
chocolate rgb(210, 105, 30)
coral rgb(255, 127, 80)
cornflowerblue rgb(100, 149, 237)
cornsilk rgb(255, 248, 220)
crimson rgb(220, 20, 60)
cyan rgb( 0, 255, 255)
darkblue rgb( 0, 0, 139)
darkcyan rgb( 0, 139, 139)
darkgoldenrod rgb(184, 134, 11)
darkgray rgb(169, 169, 169)
darkgreen rgb( 0, 100, 0)
darkgrey rgb(169, 169, 169)
darkkhaki rgb(189, 183, 107)
darkmagenta rgb(139, 0, 139)
darkolivegreen rgb( 85, 107, 47)
darkorange rgb(255, 140, 0)
darkorchid rgb(153, 50, 204)
darkred rgb(139, 0, 0)
darksalmon rgb(233, 150, 122)
darkseagreen rgb(143, 188, 143)
darkslateblue rgb( 72, 61, 139)
darkslategray rgb( 47, 79, 79)
darkslategrey rgb( 47, 79, 79)
darkturquoise rgb( 0, 206, 209)
darkviolet rgb(148, 0, 211)
deeppink rgb(255, 20, 147)
deepskyblue rgb( 0, 191, 255)
dimgray rgb(105, 105, 105)
dimgrey rgb(105, 105, 105)
dodgerblue rgb( 30, 144, 255)
firebrick rgb(178, 34, 34)
floralwhite rgb(255, 250, 240)
forestgreen rgb( 34, 139, 34)
fuchsia rgb(255, 0, 255)
gainsboro rgb(220, 220, 220)
ghostwhite rgb(248, 248, 255)
gold rgb(255, 215, 0)
goldenrod rgb(218, 165, 32)
gray rgb(128, 128, 128)
grey rgb(128, 128, 128)
green rgb( 0, 128, 0)
greenyellow rgb(173, 255, 47)
honeydew rgb(240, 255, 240)
hotpink rgb(255, 105, 180)
indianred rgb(205, 92, 92)
indigo rgb( 75, 0, 130)
ivory rgb(255, 255, 240)
khaki rgb(240, 230, 140)
lavender rgb(230, 230, 250)
lavenderblush rgb(255, 240, 245)
lawngreen rgb(124, 252, 0)
lemonchiffon rgb(255, 250, 205)
lightblue rgb(173, 216, 230)
lightcoral rgb(240, 128, 128)
lightcyan rgb(224, 255, 255)
lightgoldenrodyellow rgb(250, 250, 210)
lightgray rgb(211, 211, 211)
lightgreen rgb(144, 238, 144)
lightgrey rgb(211, 211, 211)
    
lightpink rgb(255, 182, 193)
lightsalmon rgb(255, 160, 122)
lightseagreen rgb( 32, 178, 170)
lightskyblue rgb(135, 206, 250)
lightslategray rgb(119, 136, 153)
lightslategrey rgb(119, 136, 153)
lightsteelblue rgb(176, 196, 222)
lightyellow rgb(255, 255, 224)
lime rgb( 0, 255, 0)
limegreen rgb( 50, 205, 50)
linen rgb(250, 240, 230)
magenta rgb(255, 0, 255)
maroon rgb(128, 0, 0)
mediumaquamarine rgb(102, 205, 170)
mediumblue rgb( 0, 0, 205)
mediumorchid rgb(186, 85, 211)
mediumpurple rgb(147, 112, 219)
mediumseagreen rgb( 60, 179, 113)
mediumslateblue rgb(123, 104, 238)
mediumspringgreen rgb( 0, 250, 154)
mediumturquoise rgb( 72, 209, 204)
mediumvioletred rgb(199, 21, 133)
midnightblue rgb( 25, 25, 112)
mintcream rgb(245, 255, 250)
mistyrose rgb(255, 228, 225)
moccasin rgb(255, 228, 181)
navajowhite rgb(255, 222, 173)
navy rgb( 0, 0, 128)
oldlace rgb(253, 245, 230)
olive rgb(128, 128, 0)
olivedrab rgb(107, 142, 35)
orange rgb(255, 165, 0)
orangered rgb(255, 69, 0)
orchid rgb(218, 112, 214)
palegoldenrod rgb(238, 232, 170)
palegreen rgb(152, 251, 152)
paleturquoise rgb(175, 238, 238)
palevioletred rgb(219, 112, 147)
papayawhip rgb(255, 239, 213)
peachpuff rgb(255, 218, 185)
peru rgb(205, 133, 63)
pink rgb(255, 192, 203)
plum rgb(221, 160, 221)
powderblue rgb(176, 224, 230)
purple rgb(128, 0, 128)
red rgb(255, 0, 0)
rosybrown rgb(188, 143, 143)
royalblue rgb( 65, 105, 225)
saddlebrown rgb(139, 69, 19)
salmon rgb(250, 128, 114)
sandybrown rgb(244, 164, 96)
seagreen rgb( 46, 139, 87)
seashell rgb(255, 245, 238)
sienna rgb(160, 82, 45)
silver rgb(192, 192, 192)
skyblue rgb(135, 206, 235)
slateblue rgb(106, 90, 205)
slategray rgb(112, 128, 144)
slategrey rgb(112, 128, 144)
snow rgb(255, 250, 250)
springgreen rgb( 0, 255, 127)
steelblue rgb( 70, 130, 180)
tan rgb(210, 180, 140)
teal rgb( 0, 128, 128)
thistle rgb(216, 191, 216)
tomato rgb(255, 99, 71)
turquoise rgb( 64, 224, 208)
violet rgb(238, 130, 238)
wheat rgb(245, 222, 179)
white rgb(255, 255, 255)
whitesmoke rgb(245, 245, 245)
yellow rgb(255, 255, 0)
yellowgreen rgb(154, 205, 50)
   

4.5 Basic DOM interfaces

4.5.1 Interface SVGElement

All of the SVG DOM interfaces that correspond directly to elements in the SVG language (such as the SVGPathElement interface for the ‘path’ element) derive from the SVGElement interface.
interface SVGElement : Element {
           attribute DOMString id setraises(DOMException);
           attribute DOMString xmlbase setraises(DOMException);
  readonly attribute SVGSVGElement ownerSVGElement;
  readonly attribute SVGElement viewportElement;
};
Attributes:
id (DOMString)
The value of the ‘id’ attribute on the given element, or the empty string if ‘id’ is not present.
Exceptions on setting
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised on an attempt to change the value of a read only attribute.
xmlbase (DOMString)
Corresponds to attribute ‘xml:base’ on the given element.
Exceptions on setting
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised on an attempt to change the value of a read only attribute.
ownerSVGElement (readonly SVGSVGElement)
The nearest ancestor ‘svg’ element. Null if the given element is the outermost svg element.
viewportElement (readonly SVGElement)
The element which established the current viewport. Often, the nearest ancestor ‘svg’ element. Null if the given element is the outermost svg element.

4.5.2 Interface SVGAnimatedBoolean

Used for attributes of type boolean which can be animated.
interface SVGAnimatedBoolean {
           attribute boolean baseVal setraises(DOMException);
  readonly attribute boolean animVal;
};
Attributes:
baseVal (boolean)
The base value of the given attribute before applying any animations.
Exceptions on setting
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised on an attempt to change the value of a read only attribute.
animVal (readonly boolean)
If the given attribute or property is being animated, contains the current animated value of the attribute or property. If the given attribute or property is not currently being animated, contains the same value as baseVal.

4.5.3 Interface SVGAnimatedString

Used for attributes of type DOMString which can be animated.
interface SVGAnimatedString {
           attribute DOMString baseVal setraises(DOMException);
  readonly attribute DOMString animVal;
};
Attributes:
baseVal (DOMString)
The base value of the given attribute before applying any animations.
Exceptions on setting
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised on an attempt to change the value of a read only attribute.
animVal (readonly DOMString)
If the given attribute or property is being animated, contains the current animated value of the attribute or property. If the given attribute or property is not currently being animated, contains the same value as baseVal.

4.5.4 Interface SVGStringList

This interface defines a list of DOMString values.

SVGStringList has the same attributes and methods as other SVGxxxList interfaces. Implementers may consider using a single base class to implement the various SVGxxxList interfaces.

interface SVGStringList {

  readonly attribute unsigned long numberOfItems;

  void clear() raises(DOMException);
  DOMString initialize(in DOMString newItem) raises(DOMException);
  DOMString getItem(in unsigned long index) raises(DOMException);
  DOMString insertItemBefore(in DOMString newItem, in unsigned long index) raises(DOMException);
  DOMString replaceItem(in DOMString newItem, in unsigned long index) raises(DOMException);
  DOMString removeItem(in unsigned long index) raises(DOMException);
  DOMString appendItem(in DOMString newItem) raises(DOMException);
};
Attributes:
numberOfItems (readonly unsigned long)
The number of items in the list.
Operations:
void clear()
Clears all existing current items from the list, with the result being an empty list.
Exceptions
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the list cannot be modified.
DOMString initialize(in DOMString newItem)
Clears all existing current items from the list and re-initializes the list to hold the single item specified by the parameter.
Parameters
  1. DOMString newItem
    The item which should become the only member of the list.
Returns
The item being inserted into the list.
Exceptions
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the list cannot be modified.
DOMString getItem(in unsigned long index)
Returns the specified item from the list.
Parameters
  1. unsigned long index
    The index of the item from the list which is to be returned. The first item is number 0.
Returns
The selected item.
Exceptions
DOMException, code INDEX_SIZE_ERR
Raised if the index number is greater than or equal to numberOfItems.
DOMString insertItemBefore(in DOMString newItem, in unsigned long index)
Inserts a new item into the list at the specified position. The first item is number 0.
Parameters
  1. DOMString newItem
    The item which is to be inserted into the list.
  2. unsigned long index
    The index of the item before which the new item is to be inserted. The first item is number 0. If the index is equal to 0, then the new item is inserted at the front of the list. If the index is greater than or equal to numberOfItems, then the new item is appended to the end of the list.
Returns
The inserted item.
Exceptions
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the list cannot be modified.
DOMString replaceItem(in DOMString newItem, in unsigned long index)
Replaces an existing item in the list with a new item.
Parameters
  1. DOMString newItem
    The item which is to be inserted into the list.
  2. unsigned long index
    The index of the item which is to be replaced. The first item is number 0.
Returns
The inserted item.
Exceptions
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the list cannot be modified.
DOMException, code INDEX_SIZE_ERR
Raised if the index number is greater than or equal to numberOfItems.
DOMString removeItem(in unsigned long index)
Removes an existing item from the list.
Parameters
  1. unsigned long index
    The index of the item which is to be removed. The first item is number 0.
Returns
The removed item.
Exceptions
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the list cannot be modified.
DOMException, code INDEX_SIZE_ERR
Raised if the index number is greater than or equal to numberOfItems.
DOMString appendItem(in DOMString newItem)
Inserts a new item at the end of the list.
Parameters
  1. DOMString newItem
    The item which is to be inserted. The first item is number 0.
Returns
The inserted item.
Exceptions
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the list cannot be modified.

4.5.5 Interface SVGAnimatedEnumeration

Used for attributes whose value must be a constant from a particular enumeration and which can be animated.
interface SVGAnimatedEnumeration {
           attribute unsigned short baseVal setraises(DOMException);
  readonly attribute unsigned short animVal;
};
Attributes:
baseVal (unsigned short)
The base value of the given attribute before applying any animations.
Exceptions on setting
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised on an attempt to change the value of a read only attribute.
animVal (readonly unsigned short)
If the given attribute or property is being animated, contains the current animated value of the attribute or property. If the given attribute or property is not currently being animated, contains the same value as baseVal.

4.5.6 Interface SVGAnimatedInteger

Used for attributes of basic type <integer> which can be animated.
interface SVGAnimatedInteger {
           attribute long baseVal setraises(DOMException);
  readonly attribute long animVal;
};
Attributes:
baseVal (long)
The base value of the given attribute before applying any animations.
Exceptions on setting
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised on an attempt to change the value of a read only attribute.
animVal (readonly long)
If the given attribute or property is being animated, contains the current animated value of the attribute or property. If the given attribute or property is not currently being animated, contains the same value as baseVal.

4.5.7 Interface SVGNumber

Used for attributes of basic type <number>.
interface SVGNumber {
  attribute float value setraises(DOMException);
};
Attributes:
value (float)
The value of the given attribute.
Exceptions on setting
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised on an attempt to change the value of a read only attribute.

4.5.8 Interface SVGAnimatedNumber

Used for attributes of basic type <number> which can be animated.
interface SVGAnimatedNumber {
           attribute float baseVal setraises(DOMException);
  readonly attribute float animVal;
};
Attributes:
baseVal (float)
The base value of the given attribute before applying any animations.
Exceptions on setting
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised on an attempt to change the value of a read only attribute.
animVal (readonly float)
If the given attribute or property is being animated, contains the current animated value of the attribute or property. If the given attribute or property is not currently being animated, contains the same value as baseVal.

4.5.9 Interface SVGNumberList

This interface defines a list of SVGNumber objects.

SVGNumberList has the same attributes and methods as other SVGxxxList interfaces. Implementers may consider using a single base class to implement the various SVGxxxList interfaces.

An SVGNumberList object can be designated as read only, which means that attempts to modify the object will result in an exception being thrown, as described below.

interface SVGNumberList {

  readonly attribute unsigned long numberOfItems;

  void clear() raises(DOMException);
  SVGNumber initialize(in SVGNumber newItem) raises(DOMException);
  SVGNumber getItem(in unsigned long index) raises(DOMException);
  SVGNumber insertItemBefore(in SVGNumber newItem, in unsigned long index) raises(DOMException);
  SVGNumber replaceItem(in SVGNumber newItem, in unsigned long index) raises(DOMException);
  SVGNumber removeItem(in unsigned long index) raises(DOMException);
  SVGNumber appendItem(in SVGNumber newItem) raises(DOMException);
};
Attributes:
numberOfItems (readonly unsigned long)
The number of items in the list.
Operations:
void clear()
Clears all existing current items from the list, with the result being an empty list.
Exceptions
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the list corresponds to a read only attribute or when the object itself is read only.
SVGNumber initialize(in SVGNumber newItem)
Clears all existing current items from the list and re-initializes the list to hold the single item specified by the parameter. If the inserted item is already in a list, it is removed from its previous list before it is inserted into this list. The inserted item is the item itself and not a copy.
Parameters
  1. SVGNumber newItem
    The item which should become the only member of the list.
Returns
The item being inserted into the list.
Exceptions
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the list corresponds to a read only attribute or when the object itself is read only.
SVGNumber getItem(in unsigned long index)
Returns the specified item from the list. The returned item is the item itself and not a copy. Any changes made to the item are immediately reflected in the list.
Parameters
  1. unsigned long index
    The index of the item from the list which is to be returned. The first item is number 0.
Returns
The selected item.
Exceptions
DOMException, code INDEX_SIZE_ERR
Raised if the index number is greater than or equal to numberOfItems.
SVGNumber insertItemBefore(in SVGNumber newItem, in unsigned long index)
Inserts a new item into the list at the specified position. The first item is number 0. If newItem is already in a list, it is removed from its previous list before it is inserted into this list. The inserted item is the item itself and not a copy. If the item is already in this list, note that the index of the item to insert before is before the removal of the item.
Parameters
  1. SVGNumber newItem
    The item which is to be inserted into the list.
  2. unsigned long index
    The index of the item before which the new item is to be inserted. The first item is number 0. If the index is equal to 0, then the new item is inserted at the front of the list. If the index is greater than or equal to numberOfItems, then the new item is appended to the end of the list.
Returns
The inserted item.
Exceptions
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the list corresponds to a read only attribute or when the object itself is read only.
SVGNumber replaceItem(in SVGNumber newItem, in unsigned long index)
Replaces an existing item in the list with a new item. If newItem is already in a list, it is removed from its previous list before it is inserted into this list. The inserted item is the item itself and not a copy. If the item is already in this list, note that the index of the item to replace is before the removal of the item.
Parameters
  1. SVGNumber newItem
    The item which is to be inserted into the list.
  2. unsigned long index
    The index of the item which is to be replaced. The first item is number 0.
Returns
The inserted item.
Exceptions
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the list corresponds to a read only attribute or when the object itself is read only.
DOMException, code INDEX_SIZE_ERR
Raised if the index number is greater than or equal to numberOfItems.
SVGNumber removeItem(in unsigned long index)
Removes an existing item from the list.
Parameters
  1. unsigned long index
    The index of the item which is to be removed. The first item is number 0.
Returns
The removed item.
Exceptions
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the list cannot be modified.
DOMException, code INDEX_SIZE_ERR
Raised if the index number is greater than or equal to numberOfItems.
SVGNumber appendItem(in SVGNumber newItem)
Inserts a new item at the end of the list. If newItem is already in a list, it is removed from its previous list before it is inserted into this list. The inserted item is the item itself and not a copy.
Parameters
  1. SVGNumber newItem
    The item which is to be inserted. The first item is number 0.
Returns
The inserted item.
Exceptions
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the list cannot be modified.

4.5.10 Interface SVGAnimatedNumberList

Used for attributes which take a list of numbers and which can be animated.
interface SVGAnimatedNumberList {
  readonly attribute SVGNumberList baseVal;
  readonly attribute SVGNumberList animVal;
};
Attributes:
baseVal (readonly SVGNumberList)
The base value of the given attribute before applying any animations.
animVal (readonly SVGNumberList)
A read only SVGNumberList representing the current animated value of the given attribute. If the given attribute is not currently being animated, then the SVGNumberList will have the same contents as baseVal. The object referenced by animVal will always be distinct from the one referenced by baseVal, even when the attribute is not animated.

4.5.11 Interface SVGLength

The SVGLength interface corresponds to the <length> basic data type.

An SVGLength object can be designated as read only, which means that attempts to modify the object will result in an exception being thrown, as described below.

interface SVGLength {

  // Length Unit Types
  const unsigned short SVG_LENGTHTYPE_UNKNOWN = 0;
  const unsigned short SVG_LENGTHTYPE_NUMBER = 1;
  const unsigned short SVG_LENGTHTYPE_PERCENTAGE = 2;
  const unsigned short SVG_LENGTHTYPE_EMS = 3;
  const unsigned short SVG_LENGTHTYPE_EXS = 4;
  const unsigned short SVG_LENGTHTYPE_PX = 5;
  const unsigned short SVG_LENGTHTYPE_CM = 6;
  const unsigned short SVG_LENGTHTYPE_MM = 7;
  const unsigned short SVG_LENGTHTYPE_IN = 8;
  const unsigned short SVG_LENGTHTYPE_PT = 9;
  const unsigned short SVG_LENGTHTYPE_PC = 10;

  readonly attribute unsigned short unitType;
           attribute float value setraises(DOMException);
           attribute float valueInSpecifiedUnits setraises(DOMException);
           attribute DOMString valueAsString setraises(DOMException);

  void newValueSpecifiedUnits(in unsigned short unitType, in float valueInSpecifiedUnits) raises(DOMException);
  void convertToSpecifiedUnits(in unsigned short unitType) raises(DOMException);
};
Constants in group “Length Unit Types”:
SVG_LENGTHTYPE_UNKNOWN (unsigned short)
The unit type is not one of predefined unit types. It is invalid to attempt to define a new value of this type or to attempt to switch an existing value to this type.
SVG_LENGTHTYPE_NUMBER (unsigned short)
No unit type was provided (i.e., a unitless value was specified), which indicates a value in user units.
SVG_LENGTHTYPE_PERCENTAGE (unsigned short)
A percentage value was specified.
SVG_LENGTHTYPE_EMS (unsigned short)
A value was specified using the em units defined in CSS2.
SVG_LENGTHTYPE_EXS (unsigned short)
A value was specified using the ex units defined in CSS2.
SVG_LENGTHTYPE_PX (unsigned short)
A value was specified using the px units defined in CSS2.
SVG_LENGTHTYPE_CM (unsigned short)
A value was specified using the cm units defined in CSS2.
SVG_LENGTHTYPE_MM (unsigned short)
A value was specified using the mm units defined in CSS2.
SVG_LENGTHTYPE_IN (unsigned short)
A value was specified using the in units defined in CSS2.
SVG_LENGTHTYPE_PT (unsigned short)
A value was specified using the pt units defined in CSS2.
SVG_LENGTHTYPE_PC (unsigned short)
A value was specified using the pc units defined in CSS2.
Attributes:
unitType (readonly unsigned short)
The type of the value as specified by one of the SVG_LENGTHTYPE_* constants defined on this interface.
value (float)
The value as a floating point value, in user units. Setting this attribute will cause valueInSpecifiedUnits and valueAsString to be updated automatically to reflect this setting.
Exceptions on setting
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the length corresponds to a read only attribute or when the object itself is read only.
valueInSpecifiedUnits (float)
The value as a floating point value, in the units expressed by unitType. Setting this attribute will cause value and valueAsString to be updated automatically to reflect this setting.
Exceptions on setting
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the length corresponds to a read only attribute or when the object itself is read only.
valueAsString (DOMString)
The value as a string value, in the units expressed by unitType. Setting this attribute will cause value, valueInSpecifiedUnits and unitType to be updated automatically to reflect this setting.
Exceptions on setting
DOMException, code SYNTAX_ERR
Raised if the assigned string cannot be parsed as a valid <length>.
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the length corresponds to a read only attribute or when the object itself is read only.
Operations:
void newValueSpecifiedUnits(in unsigned short unitType, in float valueInSpecifiedUnits)
Reset the value as a number with an associated unitType, thereby replacing the values for all of the attributes on the object.
Parameters
  1. unsigned short unitType
    The unit type for the value (e.g., SVG_LENGTHTYPE_MM).
  2. float valueInSpecifiedUnits
    The new value.
Exceptions
DOMException, code NOT_SUPPORTED_ERR
Raised if unitType is SVG_LENGTHTYPE_UNKNOWN or not a valid unit type constant (one of the other SVG_LENGTHTYPE_* constants defined on this interface).
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the length corresponds to a read only attribute or when the object itself is read only.
void convertToSpecifiedUnits(in unsigned short unitType)
Preserve the same underlying stored value, but reset the stored unit identifier to the given unitType. Object attributes unitType, valueInSpecifiedUnits and valueAsString might be modified as a result of this method. For example, if the original value were "0.5cm" and the method was invoked to convert to millimeters, then the unitType would be changed to SVG_LENGTHTYPE_MM, valueInSpecifiedUnits would be changed to the numeric value 5 and valueAsString would be changed to "5mm".
Parameters
  1. unsigned short unitType
    The unit type to switch to (e.g., SVG_LENGTHTYPE_MM).
Exceptions
DOMException, code NOT_SUPPORTED_ERR
Raised if unitType is SVG_LENGTHTYPE_UNKNOWN or not a valid unit type constant (one of the other SVG_LENGTHTYPE_* constants defined on this interface).
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the length corresponds to a read only attribute or when the object itself is read only.

4.5.12 Interface SVGAnimatedLength

Used for attributes of basic type <length> which can be animated.
interface SVGAnimatedLength {
  readonly attribute SVGLength baseVal;
  readonly attribute SVGLength animVal;
};
Attributes:
baseVal (readonly SVGLength)
The base value of the given attribute before applying any animations.
animVal (readonly SVGLength)
A read only SVGLength representing the current animated value of the given attribute. If the given attribute is not currently being animated, then the SVGLength will have the same contents as baseVal. The object referenced by animVal will always be distinct from the one referenced by baseVal, even when the attribute is not animated.

4.5.13 Interface SVGLengthList

This interface defines a list of SVGLength objects.

SVGLengthList has the same attributes and methods as other SVGxxxList interfaces. Implementers may consider using a single base class to implement the various SVGxxxList interfaces.

An SVGLengthList object can be designated as read only, which means that attempts to modify the object will result in an exception being thrown, as described below.

interface SVGLengthList {

  readonly attribute unsigned long numberOfItems;

  void clear() raises(DOMException);
  SVGLength initialize(in SVGLength newItem) raises(DOMException);
  SVGLength getItem(in unsigned long index) raises(DOMException);
  SVGLength insertItemBefore(in SVGLength newItem, in unsigned long index) raises(DOMException);
  SVGLength replaceItem(in SVGLength newItem, in unsigned long index) raises(DOMException);
  SVGLength removeItem(in unsigned long index) raises(DOMException);
  SVGLength appendItem(in SVGLength newItem) raises(DOMException);
};
Attributes:
numberOfItems (readonly unsigned long)
The number of items in the list.
Operations:
void clear()
Clears all existing current items from the list, with the result being an empty list.
Exceptions
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the list corresponds to a read only attribute or when the object itself is read only.
SVGLength initialize(in SVGLength newItem)
Clears all existing current items from the list and re-initializes the list to hold the single item specified by the parameter. If the inserted item is already in a list, it is removed from its previous list before it is inserted into this list. The inserted item is the item itself and not a copy.
Parameters
  1. SVGLength newItem
    The item which should become the only member of the list.
Returns
The item being inserted into the list.
Exceptions
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the list corresponds to a read only attribute or when the object itself is read only.
SVGLength getItem(in unsigned long index)
Returns the specified item from the list. The returned item is the item itself and not a copy. Any changes made to the item are immediately reflected in the list.
Parameters
  1. unsigned long index
    The index of the item from the list which is to be returned. The first item is number 0.
Returns
The selected item.
Exceptions
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the list corresponds to a read only attribute or when the object itself is read only.
SVGLength insertItemBefore(in SVGLength newItem, in unsigned long index)
Inserts a new item into the list at the specified position. The first item is number 0. If newItem is already in a list, it is removed from its previous list before it is inserted into this list. The inserted item is the item itself and not a copy. If the item is already in this list, note that the index of the item to insert before is before the removal of the item.
Parameters
  1. SVGLength newItem
    The item which is to be inserted into the list.
  2. unsigned long index
    The index of the item before which the new item is to be inserted. The first item is number 0. If the index is equal to 0, then the new item is inserted at the front of the list. If the index is greater than or equal to numberOfItems, then the new item is appended to the end of the list.
Returns
The inserted item.
Exceptions
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the list corresponds to a read only attribute or when the object itself is read only.
SVGLength replaceItem(in SVGLength newItem, in unsigned long index)
Replaces an existing item in the list with a new item. If newItem is already in a list, it is removed from its previous list before it is inserted into this list. The inserted item is the item itself and not a copy. If the item is already in this list, note that the index of the item to replace is before the removal of the item.
Parameters
  1. SVGLength newItem
    The item which is to be inserted into the list.
  2. unsigned long index
    The index of the item which is to be replaced. The first item is number 0.
Returns
The inserted item.
Exceptions
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the list corresponds to a read only attribute or when the object itself is read only.
DOMException, code INDEX_SIZE_ERR
Raised if the index number is greater than or equal to numberOfItems.
SVGLength removeItem(in unsigned long index)
Removes an existing item from the list.
Parameters
  1. unsigned long index
    The index of the item which is to be removed. The first item is number 0.
Returns
The removed item.
Exceptions
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the list corresponds to a read only attribute or when the object itself is read only.
DOMException, code INDEX_SIZE_ERR
Raised if the index number is greater than or equal to numberOfItems.
SVGLength appendItem(in SVGLength newItem)
Inserts a new item at the end of the list. If newItem is already in a list, it is removed from its previous list before it is inserted into this list. The inserted item is the item itself and not a copy.
Parameters
  1. SVGLength newItem
    The item which is to be inserted. The first item is number 0.
Returns
The inserted item.
Exceptions
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the list corresponds to a read only attribute or when the object itself is read only.

4.5.14 Interface SVGAnimatedLengthList

Used for attributes of type SVGLengthList which can be animated.
interface SVGAnimatedLengthList {
  readonly attribute SVGLengthList baseVal;
  readonly attribute SVGLengthList animVal;
};
Attributes:
baseVal (readonly SVGLengthList)
The base value of the given attribute before applying any animations.
animVal (readonly SVGLengthList)
A read only SVGLengthList representing the current animated value of the given attribute. If the given attribute is not currently being animated, then the SVGLengthList will have the same contents as baseVal. The object referenced by animVal will always be distinct from the one referenced by baseVal, even when the attribute is not animated.

4.5.15 Interface SVGAngle

The SVGAngle interface corresponds to the <angle> basic data type.

An SVGAngle object can be designated as read only, which means that attempts to modify the object will result in an exception being thrown, as described below.

interface SVGAngle {

  // Angle Unit Types
  const unsigned short SVG_ANGLETYPE_UNKNOWN = 0;
  const unsigned short SVG_ANGLETYPE_UNSPECIFIED = 1;
  const unsigned short SVG_ANGLETYPE_DEG = 2;
  const unsigned short SVG_ANGLETYPE_RAD = 3;
  const unsigned short SVG_ANGLETYPE_GRAD = 4;

  readonly attribute unsigned short unitType;
           attribute float value setraises(DOMException);
           attribute float valueInSpecifiedUnits setraises(DOMException);
           attribute DOMString valueAsString setraises(DOMException);

  void newValueSpecifiedUnits(in unsigned short unitType, in float valueInSpecifiedUnits) raises(DOMException);
  void convertToSpecifiedUnits(in unsigned short unitType) raises(DOMException);
};
Constants in group “Angle Unit Types”:
SVG_ANGLETYPE_UNKNOWN (unsigned short)
The unit type is not one of predefined unit types. It is invalid to attempt to define a new value of this type or to attempt to switch an existing value to this type.
SVG_ANGLETYPE_UNSPECIFIED (unsigned short)
No unit type was provided (i.e., a unitless value was specified). For angles, a unitless value is treated the same as if degrees were specified.
SVG_ANGLETYPE_DEG (unsigned short)
The unit type was explicitly set to degrees.
SVG_ANGLETYPE_RAD (unsigned short)
The unit type is radians.
SVG_ANGLETYPE_GRAD (unsigned short)
The unit type is radians.
Attributes:
unitType (readonly unsigned short)
The type of the value as specified by one of the SVG_ANGLETYPE_* constants defined on this interface.
value (float)
The angle value as a floating point value, in degrees. Setting this attribute will cause valueInSpecifiedUnits and valueAsString to be updated automatically to reflect this setting.
Exceptions on setting
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the angle corresponds to a read only attribute or when the object itself is read only.
valueInSpecifiedUnits (float)
The angle value as a floating point value, in the units expressed by unitType. Setting this attribute will cause value and valueAsString to be updated automatically to reflect this setting.
Exceptions on setting
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the angle corresponds to a read only attribute or when the object itself is read only.
valueAsString (DOMString)
The angle value as a string value, in the units expressed by unitType. Setting this attribute will cause value, valueInSpecifiedUnits and unitType to be updated automatically to reflect this setting.
Exceptions on setting
DOMException, code SYNTAX_ERR
Raised if the assigned string cannot be parsed as a valid <angle>.
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the angle corresponds to a read only attribute or when the object itself is read only.
Operations:
void newValueSpecifiedUnits(in unsigned short unitType, in float valueInSpecifiedUnits)
Reset the value as a number with an associated unitType, thereby replacing the values for all of the attributes on the object.
Parameters
  1. unsigned short unitType
    The unit type for the value (e.g., SVG_ANGLETYPE_DEG).
  2. float valueInSpecifiedUnits
    The angle value.
Exceptions
DOMException, code NOT_SUPPORTED_ERR
Raised if unitType is SVG_ANGLETYPE_UNKNOWN or not a valid unit type constant (one of the other SVG_ANGLETYPE_* constants defined on this interface).
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the angle corresponds to a read only attribute or when the object itself is read only.
void convertToSpecifiedUnits(in unsigned short unitType)
Preserve the same underlying stored value, but reset the stored unit identifier to the given unitType. Object attributes unitType, valueInSpecifiedUnits and valueAsString might be modified as a result of this method.
Parameters
  1. unsigned short unitType
    The unit type to switch to (e.g., SVG_ANGLETYPE_DEG).
Exceptions
DOMException, code NOT_SUPPORTED_ERR
Raised if unitType is SVG_ANGLETYPE_UNKNOWN or not a valid unit type constant (one of the other SVG_ANGLETYPE_* constants defined on this interface).
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the angle corresponds to a read only attribute or when the object itself is read only.

4.5.16 Interface SVGAnimatedAngle

Used for attributes of basic data type <angle> that can be animated.
interface SVGAnimatedAngle {
  readonly attribute SVGAngle baseVal;
  readonly attribute SVGAngle animVal;
};
Attributes:
baseVal (readonly SVGAngle)
The base value of the given attribute before applying any animations.
animVal (readonly SVGAngle)
A read only SVGAngle representing the current animated value of the given attribute. If the given attribute is not currently being animated, then the SVGAngle will have the same contents as baseVal. The object referenced by animVal will always be distinct from the one referenced by baseVal, even when the attribute is not animated.

4.5.17 Interface SVGColor

The SVGColor interface corresponds to color value definition for properties ‘stop-color’, ‘flood-color’ and ‘lighting-color’ and is a base class for interface SVGPaint. It incorporates SVG's extended notion of color, which incorporates ICC-based color specifications.

Interface SVGColor does not correspond to the <color> basic data type. For the <color> basic data type, the applicable DOM interfaces are defined in DOM Level 2 Style; in particular, see the RGBColor interface ([DOM2STYLE], section 2.2).

Note: The SVGColor interface is deprecated, and may be dropped from future versions of the SVG specification.

interface SVGColor : CSSValue {

  // Color Types
  const unsigned short SVG_COLORTYPE_UNKNOWN = 0;
  const unsigned short SVG_COLORTYPE_RGBCOLOR = 1;
  const unsigned short SVG_COLORTYPE_RGBCOLOR_ICCCOLOR = 2;
  const unsigned short SVG_COLORTYPE_CURRENTCOLOR = 3;

  readonly attribute unsigned short colorType;
  readonly attribute RGBColor rgbColor;
  readonly attribute SVGICCColor iccColor;

  void setRGBColor(in DOMString rgbColor) raises(SVGException);
  void setRGBColorICCColor(in DOMString rgbColor, in DOMString iccColor) raises(SVGException);
  void setColor(in unsigned short colorType, in DOMString rgbColor, in DOMString iccColor) raises(SVGException);
};
Constants in group “Color Types”:
SVG_COLORTYPE_UNKNOWN (unsigned short)
The color type is not one of predefined types. It is invalid to attempt to define a new value of this type or to attempt to switch an existing value to this type.
SVG_COLORTYPE_RGBCOLOR (unsigned short)
An sRGB color has been specified without an alternative ICC color specification.
SVG_COLORTYPE_RGBCOLOR_ICCCOLOR (unsigned short)
An sRGB color has been specified along with an alternative ICC color specification.
SVG_COLORTYPE_CURRENTCOLOR (unsigned short)
Corresponds to when keyword currentColor has been specified.
Attributes:
colorType (readonly unsigned short)
The type of the value as specified by one of the SVG_COLORTYPE_* constants defined on this interface.
rgbColor (readonly RGBColor)
The color specified in the sRGB color space.
iccColor (readonly SVGICCColor)
The alternate ICC color specification.
Operations:
void setRGBColor(in DOMString rgbColor)
Modifies the color value to be the specified sRGB color without an alternate ICC color specification.
Parameters
  1. DOMString rgbColor
    A string that matches <color>, which specifies the new sRGB color value.
Exceptions
SVGException, code SVG_INVALID_VALUE_ERR
Raised if rgbColor does not match <color>.
void setRGBColorICCColor(in DOMString rgbColor, in DOMString iccColor)
Modifies the color value to be the specified sRGB color with an alternate ICC color specification.
Parameters
  1. DOMString rgbColor
    A string that matches <color>, which specifies the new sRGB color value.
  2. DOMString iccColor
    A string that matches <icccolor>, which specifies the alternate ICC color specification.
Exceptions
SVGException, code SVG_INVALID_VALUE_ERR
Raised if rgbColor does not match <color> or if iccColor does not match <icccolor>.
void setColor(in unsigned short colorType, in DOMString rgbColor, in DOMString iccColor)
Sets the color value as specified by the parameters. If colorType requires an RGBColor, then rgbColor must be a string that matches <color>; otherwise, rgbColor. must be null. If colorType requires an SVGICCColor, then iccColor must be a string that matches <icccolor>; otherwise, iccColor must be null.
Parameters
  1. unsigned short colorType
    One of the defined constants for colorType.
  2. DOMString rgbColor
    The specification of an sRGB color, or null.
  3. DOMString iccColor
    The specification of an ICC color, or null.
Exceptions
SVGException, code SVG_INVALID_VALUE_ERR
Raised if one of the parameters has an invalid value.

4.5.18 Interface SVGICCColor

The SVGICCColor interface expresses an ICC-based color specification.

Note: The SVGICCColor interface is deprecated, and may be dropped from future versions of the SVG specification.

interface SVGICCColor {
           attribute DOMString colorProfile setraises(DOMException);
  readonly attribute SVGNumberList colors;
};
Attributes:
colorProfile (DOMString)
The name of the color profile, which is the first parameter of an ICC color specification.
Exceptions on setting
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised on an attempt to change the value of a read only attribute.
colors (readonly SVGNumberList)
The list of color values that define this ICC color. Each color value is an arbitrary floating point number.

4.5.19 Interface SVGRect

Represents rectangular geometry. Rectangles are defined as consisting of a (x,y) coordinate pair identifying a minimum X value, a minimum Y value, and a width and height, which are usually constrained to be non-negative.

An SVGRect object can be designated as read only, which means that attempts to modify the object will result in an exception being thrown, as described below.

interface SVGRect {
  attribute float x setraises(DOMException);
  attribute float y setraises(DOMException);
  attribute float width setraises(DOMException);
  attribute float height setraises(DOMException);
};
Attributes:
x (float)
The x coordinate of the rectangle, in user units.
Exceptions on setting
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the rectangle corresponds to a read only attribute or when the object itself is read only.
y (float)
The y coordinate of the rectangle, in user units.
Exceptions on setting
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the rectangle corresponds to a read only attribute or when the object itself is read only.
width (float)
The width coordinate of the rectangle, in user units.
Exceptions on setting
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the rectangle corresponds to a read only attribute or when the object itself is read only.
height (float)
The height coordinate of the rectangle, in user units.
Exceptions on setting
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the rectangle corresponds to a read only attribute or when the object itself is read only.

4.5.20 Interface SVGAnimatedRect

Used for attributes of type SVGRect which can be animated.
interface SVGAnimatedRect {
  readonly attribute SVGRect baseVal;
  readonly attribute SVGRect animVal;
};
Attributes:
baseVal (readonly SVGRect)
The base value of the given attribute before applying any animations.
animVal (readonly SVGRect)
A read only SVGRect representing the current animated value of the given attribute. If the given attribute is not currently being animated, then the SVGRect will have the same contents as baseVal. The object referenced by animVal will always be distinct from the one referenced by baseVal, even when the attribute is not animated.

4.5.21 Interface SVGUnitTypes

The SVGUnitTypes interface defines a commonly used set of constants and is a base interface used by SVGGradientElement, SVGPatternElement, SVGClipPathElement, SVGMaskElement and SVGFilterElement.
interface SVGUnitTypes {
  // Unit Types
  const unsigned short SVG_UNIT_TYPE_UNKNOWN = 0;
  const unsigned short SVG_UNIT_TYPE_USERSPACEONUSE = 1;
  const unsigned short SVG_UNIT_TYPE_OBJECTBOUNDINGBOX = 2;
};
Constants in group “Unit Types”:
SVG_UNIT_TYPE_UNKNOWN (unsigned short)
The type is not one of predefined types. It is invalid to attempt to define a new value of this type or to attempt to switch an existing value to this type.
SVG_UNIT_TYPE_USERSPACEONUSE (unsigned short)
Corresponds to value 'userSpaceOnUse'.
SVG_UNIT_TYPE_OBJECTBOUNDINGBOX (unsigned short)
Corresponds to value 'objectBoundingBox'.

4.5.22 Interface SVGStylable

The SVGStylable interface is implemented on all objects corresponding to SVG elements that can have ‘style’, ‘class’ and presentation attributes specified on them. It is thus an ancestor interface for many of the interfaces defined in this specification.
interface SVGStylable {

  readonly attribute SVGAnimatedString className;
  readonly attribute CSSStyleDeclaration style;

  CSSValue getPresentationAttribute(in DOMString name);
};
Attributes:
className (readonly SVGAnimatedString)
Corresponds to attribute ‘class’ on the given element.
style (readonly CSSStyleDeclaration)
Corresponds to attribute ‘style’ on the given element. If the user agent does not support styling with CSS, then this attribute must always have the value of null.
Operations:
CSSValue getPresentationAttribute(in DOMString name)
Returns the base (i.e., static) value of a given presentation attribute as an object of type CSSValue. The returned object is live; changes to the objects represent immediate changes to the objects to which the CSSValue is attached.

Note: The getPresentationAttribute method is deprecated, and may be dropped from future versions of the SVG specification.

Parameters
  1. DOMString name
    The name of the presentation attribute whose value is to be returned.
Returns
The static/base value of the given presentation attribute as a CSSValue, or null if the given attribute does not have a specified value.

4.5.23 Interface SVGLocatable

Interface SVGLocatable is for all elements which either have a ‘transform’ attribute or don't have a ‘transform’ attribute but whose content can have a bounding box in current user space.
interface SVGLocatable {

  readonly attribute SVGElement nearestViewportElement;
  readonly attribute SVGElement farthestViewportElement;

  SVGRect getBBox();
  SVGMatrix getCTM();
  SVGMatrix getScreenCTM();
  SVGMatrix getTransformToElement(in SVGElement element) raises(SVGException);
};
Attributes:
nearestViewportElement (readonly SVGElement)
The element which established the current viewport. Often, the nearest ancestor ‘svg’ element. Null if the current element is the outermost svg element.
farthestViewportElement (readonly SVGElement)
The farthest ancestor ‘svg’ element. Null if the current element is the outermost svg element.
Operations:
SVGRect getBBox()
Returns the tight bounding box in current user space (i.e., after application of the ‘transform’ attribute, if any) on the geometry of all contained graphics elements, exclusive of stroking, clipping, masking and filter effects). Note that getBBox must return the actual bounding box at the time the method was called, even in case the element has not yet been rendered.
Returns
An SVGRect object that defines the bounding box.
SVGMatrix getCTM()
Returns the transformation matrix from current user units (i.e., after application of the ‘transform’ attribute, if any) to the viewport coordinate system for the nearestViewportElement.
Returns
An SVGMatrix object that defines the CTM.
SVGMatrix getScreenCTM()
Returns the transformation matrix from current user units (i.e., after application of the ‘transform’ attribute, if any) to the parent user agent's notice of a "pixel". For display devices, ideally this represents a physical screen pixel. For other devices or environments where physical pixel sizes are not known, then an algorithm similar to the CSS2 definition of a "pixel" can be used instead. Note that null is returned if this element is not hooked into the document tree. This method would have been more aptly named as getClientCTM, but the name getScreenCTM is kept for historical reasons.
Returns
An SVGMatrix object that defines the given transformation matrix.
SVGMatrix getTransformToElement(in SVGElement element)
Returns the transformation matrix from the user coordinate system on the current element (after application of the ‘transform’ attribute, if any) to the user coordinate system on parameter element (after application of its ‘transform’ attribute, if any).
Parameters
  1. SVGElement element
    The target element.
Returns
An SVGMatrix object that defines the transformation.
Exceptions
SVGException, code SVG_MATRIX_NOT_INVERTABLE
Raised if the currently defined transformation matrices make it impossible to compute the given matrix (e.g., because one of the transformations is singular).

4.5.24 Interface SVGTransformable

Interface SVGTransformable contains properties and methods that apply to all elements which have attribute ‘transform’.
interface SVGTransformable : SVGLocatable {
  readonly attribute SVGAnimatedTransformList transform;
};
Attributes:
transform (readonly SVGAnimatedTransformList)
Corresponds to attribute ‘transform’ on the given element.

4.5.25 Interface SVGTests

Interface SVGTests defines an interface which applies to all elements which have attributes ‘requiredFeatures’, ‘requiredExtensions’ and ‘systemLanguage’.
interface SVGTests {

  readonly attribute SVGStringList requiredFeatures;
  readonly attribute SVGStringList requiredExtensions;
  readonly attribute SVGStringList systemLanguage;

  boolean hasExtension(in DOMString extension);
};
Attributes:
requiredFeatures (readonly SVGStringList)
Corresponds to attribute ‘requiredFeatures’ on the given element.
requiredExtensions (readonly SVGStringList)
Corresponds to attribute ‘requiredExtensions’ on the given element.
systemLanguage (readonly SVGStringList)
Corresponds to attribute ‘systemLanguage’ on the given element.
Operations:
boolean hasExtension(in DOMString extension)
Returns true if the user agent supports the given extension, specified by a URI.
Parameters
  1. DOMString extension
    The name of the extension, expressed as a URI.
Returns
True or false, depending on whether the given extension is supported.

4.5.26 Interface SVGLangSpace

Interface SVGLangSpace defines an interface which applies to all elements which have attributes ‘xml:lang’ and ‘xml:space’.
interface SVGLangSpace {
  attribute DOMString xmllang setraises(DOMException);
  attribute DOMString xmlspace setraises(DOMException);
};
Attributes:
xmllang (DOMString)
Corresponds to attribute ‘xml:lang’ on the given element.
Exceptions on setting
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised on an attempt to change the value of a read only attribute.
xmlspace (DOMString)
Corresponds to attribute ‘xml:space’ on the given element.
Exceptions on setting
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised on an attempt to change the value of a read only attribute.

4.5.27 Interface SVGExternalResourcesRequired

Interface SVGExternalResourcesRequired defines an interface which applies to all elements where this element or one of its descendants can reference an external resource.
interface SVGExternalResourcesRequired {
  readonly attribute SVGAnimatedBoolean externalResourcesRequired;
};
Attributes:
externalResourcesRequired (readonly SVGAnimatedBoolean)
Corresponds to attribute ‘externalResourcesRequired’ on the given element. Note that the SVG DOM defines the attribute ‘externalResourcesRequired’ as being of type SVGAnimatedBoolean, whereas the SVG language definition says that ‘externalResourcesRequired’ is not animated. Because the SVG language definition states that ‘externalResourcesRequired’ cannot be animated, the animVal will always be the same as the baseVal.

4.5.28 Interface SVGFitToViewBox

Interface SVGFitToViewBox defines DOM attributes that apply to elements which have XML attributes ‘viewBox’ and ‘preserveAspectRatio’.
interface SVGFitToViewBox {
  readonly attribute SVGAnimatedRect viewBox;
  readonly attribute SVGAnimatedPreserveAspectRatio preserveAspectRatio;
};
Attributes:
viewBox (readonly SVGAnimatedRect)
Corresponds to attribute ‘viewBox’ on the given element.
preserveAspectRatio (readonly SVGAnimatedPreserveAspectRatio)
Corresponds to attribute ‘preserveAspectRatio’ on the given element.

4.5.29 Interface SVGZoomAndPan

The SVGZoomAndPan interface defines attribute zoomAndPan and associated constants.
interface SVGZoomAndPan {

  // Zoom and Pan Types
  const unsigned short SVG_ZOOMANDPAN_UNKNOWN = 0;
  const unsigned short SVG_ZOOMANDPAN_DISABLE = 1;
  const unsigned short SVG_ZOOMANDPAN_MAGNIFY = 2;

  attribute unsigned short zoomAndPan setraises(DOMException);
};
Constants in group “Zoom and Pan Types”:
SVG_ZOOMANDPAN_UNKNOWN (unsigned short)
The enumeration was set to a value that is not one of predefined types. It is invalid to attempt to define a new value of this type or to attempt to switch an existing value to this type.
SVG_ZOOMANDPAN_DISABLE (unsigned short)
Corresponds to value 'disable'.
SVG_ZOOMANDPAN_MAGNIFY (unsigned short)
Corresponds to value 'magnify'.
Attributes:
zoomAndPan (unsigned short)
Corresponds to attribute ‘zoomAndPan’ on the given element. The value must be one of the SVG_ZOOMANDPAN_* constants defined on this interface.
Exceptions on setting
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised on an attempt to change the value of a read only attribute.

4.5.30 Interface SVGViewSpec

The interface corresponds to an SVG View Specification.
interface SVGViewSpec : SVGZoomAndPan,
                        SVGFitToViewBox {
  readonly attribute SVGTransformList transform;
  readonly attribute SVGElement viewTarget;
  readonly attribute DOMString viewBoxString;
  readonly attribute DOMString preserveAspectRatioString;
  readonly attribute DOMString transformString;
  readonly attribute DOMString viewTargetString;
};
Attributes:
transform (readonly SVGTransformList)
Corresponds to the transform setting on the SVG View Specification.
viewTarget (readonly SVGElement)
Corresponds to the viewTarget setting on the SVG View Specification.
viewBoxString (readonly DOMString)
Corresponds to the viewBox setting on the SVG View Specification.
preserveAspectRatioString (readonly DOMString)
Corresponds to the preserveAspectRatio setting on the SVG View Specification.
transformString (readonly DOMString)
Corresponds to the transform setting on the SVG View Specification.
viewTargetString (readonly DOMString)
Corresponds to the viewTarget setting on the SVG View Specification.

4.5.31 Interface SVGURIReference

Interface SVGURIReference defines an interface which applies to all elements which have the collection of XLink attributes, such as ‘xlink:href’, which define a URI reference.
interface SVGURIReference {
  readonly attribute SVGAnimatedString href;
};
Attributes:
href (readonly SVGAnimatedString)
Corresponds to attribute ‘xlink:href’ on the given element.

4.5.32 Interface SVGCSSRule

SVG extends interface CSSRule with interface SVGCSSRule by adding an SVGColorProfileRule rule to allow for specification of ICC-based color.

It is likely that this extension will become part of a future version of CSS and DOM.

interface SVGCSSRule : CSSRule {
  const unsigned short COLOR_PROFILE_RULE = 7;
};
Constants:
COLOR_PROFILE_RULE (unsigned short)
The rule is an @color-profile.

4.5.33 Interface SVGRenderingIntent

The SVGRenderingIntent interface defines the enumerated list of possible values for ‘rendering-intent’ attributes or descriptors.
interface SVGRenderingIntent {
  // Rendering Intent Types
  const unsigned short RENDERING_INTENT_UNKNOWN = 0;
  const unsigned short RENDERING_INTENT_AUTO = 1;
  const unsigned short RENDERING_INTENT_PERCEPTUAL = 2;
  const unsigned short RENDERING_INTENT_RELATIVE_COLORIMETRIC = 3;
  const unsigned short RENDERING_INTENT_SATURATION = 4;
  const unsigned short RENDERING_INTENT_ABSOLUTE_COLORIMETRIC = 5;
};
Constants in group “Rendering Intent Types”:
RENDERING_INTENT_UNKNOWN (unsigned short)
The type is not one of predefined types. It is invalid to attempt to define a new value of this type or to attempt to switch an existing value to this type.
RENDERING_INTENT_AUTO (unsigned short)
Corresponds to a value of 'auto'.
RENDERING_INTENT_PERCEPTUAL (unsigned short)
Corresponds to a value of 'perceptual'.
RENDERING_INTENT_RELATIVE_COLORIMETRIC (unsigned short)
Corresponds to a value of 'relative-colorimetric'.
RENDERING_INTENT_SATURATION (unsigned short)
Corresponds to a value of 'saturation'.
RENDERING_INTENT_ABSOLUTE_COLORIMETRIC (unsigned short)
Corresponds to a value of 'absolute-colorimetric'.
SVG 1.1 (Second Edition) – 16 August 2011Top ⋅ Contents ⋅ Previous ⋅ Next ⋅ Elements ⋅ Attributes ⋅ Properties
上一篇: 下一篇: