©
Dieses Dokument verwendetPHP-Handbuch für chinesische WebsitesFreigeben
The EBNF grammar is as used in the XML specification, with the addition of~, acase-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 |
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 (includingpresentation 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.
Angles are specified in one of two ways depending upon whether they are used in CSSpropertysyntax or SVGpresentation attributesyntax:
When an
angle::= number (~"deg" | ~"grad" | ~"rad")?
wheredegindicates degrees,gradindicates grads andradindicates 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-specificpropertiesthe angle unit identifier is optional. If a unit is not provided, the angle value is assumed to be in degrees.
When an
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,
The basic type
anything::= Char*
where Char is the production for a character, as defined in XML 1.0 ([XML10], section 2.2).
The basic type
SVG supports all of the syntax alternatives for
A
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,#fb0expands 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-keywordhexdigit::= [0-9A-Fa-f]comma::= wsp* "," wsp*
wherecolor-keywordmatches (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
A
coordinate ::= length
Within the SVG DOM, a
Frequency values are used with aural properties. As defined in CSS2, a frequency value is a
Frequency values may not be negative.
In the SVG DOM,
An
icccolor::= "icc-color(" name (comma-wsp number)+ ")" name ::= [^,()#x20#x9#xD#xA] /* any char except ",", "(", ")" or wsp */
The corresponding SVG DOM interface for
An
integer::= [+-]? [0-9]+
If the sign character is not present, the number is non-negative.
Unless stated otherwise for a particular attribute orproperty, the range for an
Within the SVG DOM, an
An Internationalized Resource Identifier (seeIRI). For the specification ofIRIreferences in SVG, see IRI references.
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 CSSpropertysyntax or SVGpresentation attributesyntax:
When a
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-specificproperties, 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 ::= 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
In the SVG DOM,
A
A
The following is an EBNF grammar describing the
list-of-strings ::= string | string wsp list-of-strings string ::= [^#x9#xA#xD#x20]* wsp ::= [#x9#xA#xD#x20]+
(WhereTis a type other than
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::=T|Tcomma-wsp list-of-Tscomma-wsp::= (wsp+ ","? wsp*) | ("," wsp*)wsp::= (#x20 | #x9 | #xD | #xA)
Within the SVG DOM, values of a
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 */
Real numbers are specified in one of two ways. When used in a style sheet, a
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 ::= integer ([Ee] integer)? | [+-]? [0-9]* "." [0-9]+ ([Ee] integer)?
Within the SVG DOM, a
A pair of
number-optional-number ::= number | number comma-wsp number
In the SVG DOM, a
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
Within the SVG DOM,
Percentages are specified as a number followed by a "%" character:
percentage::= number "%"
Note that the definition of
Percentage values are always relative to another value, for example a length. Each attribute orpropertythat allows percentages also defines the reference distance measurement to which the percentage refers.
Within the SVG DOM, a
A time value is a
In the SVG DOM,
A
Within the SVG DOM, a
An XML name, as defined by the Name production inExtensible Markup Language (XML) 1.0([XML10], section 2.3).
Unless stated otherwise for a particular attribute orproperty, a
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.
The following is the list of recognized color keywords that can be used as a keyword value for data type
|
|
interfaceSVGElement: Element { attribute DOMString id setraises(DOMException); attribute DOMString xmlbase setraises(DOMException); readonly attribute SVGSVGElement ownerSVGElement; readonly attribute SVGElement viewportElement; };
interfaceSVGAnimatedBoolean{ attribute boolean baseVal setraises(DOMException); readonly attribute boolean animVal; };
interfaceSVGAnimatedString{ attribute DOMString baseVal setraises(DOMException); readonly attribute DOMString animVal; };
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.
interfaceSVGStringList{ 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); };
interfaceSVGAnimatedEnumeration{ attribute unsigned short baseVal setraises(DOMException); readonly attribute unsigned short animVal; };
interfaceSVGAnimatedInteger{ attribute long baseVal setraises(DOMException); readonly attribute long animVal; };
interfaceSVGNumber{ attribute float value setraises(DOMException); };
interfaceSVGAnimatedNumber{ attribute float baseVal setraises(DOMException); readonly attribute float animVal; };
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 asread only, which means that attempts to modify the object will result in an exception being thrown, as described below.
interfaceSVGNumberList{ 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); };
interfaceSVGAnimatedNumberList{ readonly attribute SVGNumberList baseVal; readonly attribute SVGNumberList animVal; };
The SVGLength interface corresponds to the
An SVGLength object can be designated asread only, which means that attempts to modify the object will result in an exception being thrown, as described below.
interfaceSVGLength{ // 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); };
interfaceSVGAnimatedLength{ readonly attribute SVGLength baseVal; readonly attribute SVGLength animVal; };
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 asread only, which means that attempts to modify the object will result in an exception being thrown, as described below.
interfaceSVGLengthList{ 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); };
interfaceSVGAnimatedLengthList{ readonly attribute SVGLengthList baseVal; readonly attribute SVGLengthList animVal; };
The SVGAngle interface corresponds to the
An SVGAngle object can be designated asread only, which means that attempts to modify the object will result in an exception being thrown, as described below.
interfaceSVGAngle{ // 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); };
interfaceSVGAnimatedAngle{ readonly attribute SVGAngle baseVal; readonly attribute SVGAngle animVal; };
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 doesnotcorrespond to the
Note: The SVGColor interface is deprecated, and may be dropped from future versions of the SVG specification.
interfaceSVGColor: 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); };
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.
interfaceSVGICCColor{ attribute DOMString colorProfile setraises(DOMException); readonly attribute SVGNumberList colors; };
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 asread only, which means that attempts to modify the object will result in an exception being thrown, as described below.
interfaceSVGRect{ attribute float x setraises(DOMException); attribute float y setraises(DOMException); attribute float width setraises(DOMException); attribute float height setraises(DOMException); };
interfaceSVGAnimatedRect{ readonly attribute SVGRect baseVal; readonly attribute SVGRect animVal; };
interfaceSVGUnitTypes{ // 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; };
interfaceSVGStylable{ readonly attribute SVGAnimatedString className; readonly attribute CSSStyleDeclaration style; CSSValue getPresentationAttribute(in DOMString name); };
Note: ThegetPresentationAttribute
method is deprecated, and may be dropped from future versions of the SVG specification.
interfaceSVGLocatable{ readonly attribute SVGElement nearestViewportElement; readonly attribute SVGElement farthestViewportElement; SVGRect getBBox(); SVGMatrix getCTM(); SVGMatrix getScreenCTM(); SVGMatrix getTransformToElement(in SVGElement element) raises(SVGException); };
getClientCTM
, but the name
getScreenCTM
is kept for historical reasons.
interfaceSVGTransformable: SVGLocatable { readonly attribute SVGAnimatedTransformList transform; };
interfaceSVGTests{ readonly attribute SVGStringList requiredFeatures; readonly attribute SVGStringList requiredExtensions; readonly attribute SVGStringList systemLanguage; boolean hasExtension(in DOMString extension); };
interfaceSVGLangSpace{ attribute DOMString xmllang setraises(DOMException); attribute DOMString xmlspace setraises(DOMException); };
interfaceSVGExternalResourcesRequired{ readonly attribute SVGAnimatedBoolean externalResourcesRequired; };
interfaceSVGFitToViewBox{ readonly attribute SVGAnimatedRect viewBox; readonly attribute SVGAnimatedPreserveAspectRatio preserveAspectRatio; };
interfaceSVGZoomAndPan{ // 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); };
interfaceSVGViewSpec: 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; };
interfaceSVGURIReference{ readonly attribute SVGAnimatedString href; };
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.
interfaceSVGCSSRule: CSSRule { const unsigned short COLOR_PROFILE_RULE = 7; };
interfaceSVGRenderingIntent{ // 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; };