SVGStringList

SVG string list interface

SVGStringList defines a list of DOMString 对象。

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

Interface overview

Also implement None
方法
特性
  • readonly unsigned long numberOfItems
  • readonly unsigned long length
Normative document SVG 1.1 (2nd Edition)

特性

Name Type 描述
numberOfItems unsigned long The number of items in the list.
length unsigned long A mirror of the value in numberOfItems , for consistency with other interfaces.

方法

Name & Arguments 返回 描述
clear () void

Clears all existing current items from the list, with the result being an empty list.

Exceptions:

  • a DOMException with code NO_MODIFICATION_ALLOWED_ERR is raised when the list corresponds to a read only attribute or when the object itself is read only.
initialize (in DOMString newItem ) DOMString

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. The return value is the item inserted into the list.

Exceptions:

  • a DOMException with code NO_MODIFICATION_ALLOWED_ERR is raised when the list corresponds to a read only attribute or when the object itself is read only.
getItem (in unsigned long index ) DOMString

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. The first item is number 0.

Exceptions:

  • a DOMException with code NO_MODIFICATION_ALLOWED_ERR is raised when the list corresponds to a read only attribute or when the object itself is read only.
insertItemBefore (in DOMString newItem , in unsigned long index ) DOMString

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. 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.

Exceptions:

  • a DOMException with code NO_MODIFICATION_ALLOWED_ERR is raised when the list corresponds to a read only attribute or when the object itself is read only.
replaceItem (in DOMString newItem , in unsigned long index ) DOMString

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.

Exceptions:

  • a DOMException with code NO_MODIFICATION_ALLOWED_ERR is raised when the list corresponds to a read only attribute or when the object itself is read only.
  • a DOMException with code INDEX_SIZE_ERR is raised if the index number is greater than or equal to numberOfItems .
removeItem (in unsigned long index ) DOMString

Removes an existing item from the list.

Exceptions:

  • a DOMException with code NO_MODIFICATION_ALLOWED_ERR is raised when the list corresponds to a read only attribute or when the object itself is read only.
  • a DOMException with code INDEX_SIZE_ERR is raised if the index number is greater than or equal to numberOfItems .
appendItem (in DOMString newItem ) DOMString

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.

Exceptions:

  • a DOMException with code NO_MODIFICATION_ALLOWED_ERR is raised when the list corresponds to a read only attribute or when the object itself is read only.

浏览器兼容性

更新 GitHub 上的兼容性数据
Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
SVGStringList Chrome Yes Edge 12 Firefox 12
12
Since version 13, SVGStringList is indexable like Array which is a non-standard behavior.
IE 9 Opera Yes Safari Yes WebView Android Yes Chrome Android Yes Firefox Android 14
14
SVGStringList is indexable like Array which is a non-standard behavior.
Opera Android Yes Safari iOS Yes Samsung Internet Android Yes
length
非标
Chrome Yes Edge ≤79 Firefox 13 IE ? Opera Yes Safari ? WebView Android Yes Chrome Android Yes Firefox Android 14 Opera Android Yes Safari iOS ? Samsung Internet Android Yes

图例

完整支持
完整支持
兼容性未知
兼容性未知
非标。预期跨浏览器支持较差。
非标。预期跨浏览器支持较差。
见实现注意事项。
  1. SVGStringList
  2. Related pages for SVG
    1. SVGAElement
    2. SVGAltGlyphElement
    3. SVGAngle
    4. SVGAnimateColorElement
    5. SVGAnimateElement
    6. SVGAnimateMotionElement
    7. SVGAnimateTransformElement
    8. SVGAnimatedAngle
    9. SVGAnimatedBoolean
    10. SVGAnimatedEnumeration
    11. SVGAnimatedInteger
    12. SVGAnimatedLength
    13. SVGAnimatedLengthList
    14. SVGAnimatedNumber
    15. SVGAnimatedNumberList
    16. SVGAnimatedPathData
    17. SVGAnimatedPoints
    18. SVGAnimatedPreserveAspectRatio
    19. SVGAnimatedRect
    20. SVGAnimatedString
    21. SVGAnimatedTransformList
    22. SVGAnimationElement
    23. SVGCircleElement
    24. SVGClipPathElement
    25. SVGComponentTransferFunctionElement
    26. SVGCursorElement
    27. SVGDefsElement
    28. SVGDescElement
    29. SVGDocument
    30. SVGElement
    31. SVGEllipseElement
    32. SVGFEBlendElement
    33. SVGFEColorMatrixElement
    34. SVGFEComponentTransferElement
    35. SVGFECompositeElement
    36. SVGFEConvolveMatrixElement
    37. SVGFEDiffuseLightingElement
    38. SVGFEDisplacementMapElement
    39. SVGFEDistantLightElement
    40. SVGFEDropShadowElement
    41. SVGFEFloodElement
    42. SVGFEFuncAElement
    43. SVGFEFuncBElement
    44. SVGFEFuncGElement
    45. SVGFEFuncRElement
    46. SVGFEGaussianBlurElement
    47. SVGFEImageElement
    48. SVGFEMergeElement
    49. SVGFEMergeNodeElement
    50. SVGFEMorphologyElement
    51. SVGFEOffsetElement
    52. SVGFEPointLightElement
    53. SVGFESpecularLightingElement
    54. SVGFESpotLightElement
    55. SVGFETileElement
    56. SVGFETurbulenceElement
    57. SVGFilterElement
    58. SVGFilterPrimitiveStandardAttributes
    59. SVGFitToViewBox
    60. SVGFontElement
    61. SVGFontFaceElement
    62. SVGFontFaceFormatElement
    63. SVGFontFaceNameElement
    64. SVGFontFaceSrcElement
    65. SVGFontFaceUriElement
    66. SVGForeignObjectElement
    67. SVGGElement
    68. SVGGlyphElement
    69. SVGGradientElement
    70. SVGGraphicsElement
    71. SVGHKernElement
    72. SVGImageElement
    73. SVGLength
    74. SVGLengthList
    75. SVGLineElement
    76. SVGLinearGradientElement
    77. SVGMPathElement
    78. SVGMarkerElement
    79. SVGMaskElement
    80. SVGMatrix
    81. SVGMetadataElement
    82. SVGMissingGlyphElement
    83. SVGNumber
    84. SVGNumberList
    85. SVGPathElement
    86. SVGPathSeg
    87. SVGPathSegArcAbs
    88. SVGPathSegArcRel
    89. SVGPathSegClosePath
    90. SVGPathSegCurvetoCubicAbs
    91. SVGPathSegCurvetoCubicRel
    92. SVGPathSegCurvetoCubicSmoothAbs
    93. SVGPathSegCurvetoCubicSmoothRel
    94. SVGPathSegCurvetoQuadraticAbs
    95. SVGPathSegCurvetoQuadraticRel
    96. SVGPathSegCurvetoQuadraticSmoothAbs
    97. SVGPathSegCurvetoQuadraticSmoothRel
    98. SVGPathSegLinetoAbs
    99. SVGPathSegLinetoHorizontalAbs
    100. SVGPathSegLinetoHorizontalRel
    101. SVGPathSegLinetoRel
    102. SVGPathSegLinetoVerticalAbs
    103. SVGPathSegLinetoVerticalRel
    104. SVGPathSegList
    105. SVGPathSegMovetoAbs
    106. SVGPathSegMovetoRel
    107. SVGPatternElement
    108. SVGPoint
    109. SVGPointList
    110. SVGPolygonElement
    111. SVGPolylineElement
    112. SVGPreserveAspectRatio
    113. SVGRadialGradientElement
    114. SVGRect
    115. SVGRectElement
    116. SVGSVGElement
    117. SVGScriptElement
    118. SVGSetElement
    119. SVGStopElement
    120. SVGStylable
    121. SVGStyleElement
    122. SVGSwitchElement
    123. SVGSymbolElement
    124. SVGTRefElement
    125. SVGTSpanElement
    126. SVGTests
    127. SVGTextContentElement
    128. SVGTextElement
    129. SVGTextPathElement
    130. SVGTextPositioningElement
    131. SVGTitleElement
    132. SVGTransform
    133. SVGTransformList
    134. SVGTransformable
    135. SVGURIReference
    136. SVGUnitTypes
    137. SVGUseElement
    138. SVGVKernElement
    139. SVGViewElement
    140. SVGZoomAndPan
    141. SVGZoomEvent
    142. TimeEvent