SVGAElement

SVGAElement interface provides access to the properties of <a> element, as well as methods to manipulate them.

特性

This interface also inherits properties from its parent, SVGGraphicsElement , and implements properties from SVGURIReference and HTMLHyperlinkElementUtils .

SVGAElement.download
HTMLAnchorElement.download .
SVGAElement.href
HTMLAnchorElement.href .
SVGAElement.hreflang
DOMString that reflects the hreflang attribute, indicating the language of the linked resource.
SVGAElement.ping
DOMString that reflects the ping attribute, containing a space-separated list of URLs to which, when the hyperlink is followed, POST requests with the body PING will be sent by the browser (in the background). Typically used for tracking.
SVGAElement.referrerPolicy
HTMLAnchorElement.referrerPolicy .
SVGAElement.rel
HTMLAnchorElement.rel .
SVGAElement.relList
HTMLAnchorElement.relList .
SVGAElement.target 只读
It corresponds to the target attribute of the given element.
SVGAElement.text
DOMString being a synonym for the Node.textContent 特性。
SVGAElement.type
DOMString that reflects the type attribute, indicating the MIME type of the linked resource.

方法

This interface has no methods but inherits methods from its parent, SVGGraphicsElement .

范例

In the example below, the target attribute of the <a> element is set to _blank and when the link is clicked, it logs to notify whether the condition is met or not.

var linkRef = document.querySelector("a");
linkRef.target = "_self";
linkRef.onclick = function(){
  if (linkRef.target === "_blank") {
    console.log("BLANK!");
    linkRef.target = "_self";
  } else {
    console.log("SORRY! not _blank");
  }
}
					

规范

规范 状态 Comment
Scalable Vector Graphics (SVG) 2 候选推荐 Replaced inheritance from SVGElement by SVGGraphicsElement and removed the interface implementations of SVGTests , SVGLangSpace , SVGExternalResourcesRequired , SVGStylable ,和 SVGTransformable by HTMLHyperlinkElementUtils
Scalable Vector Graphics (SVG) 1.1 (Second Edition) Recommendation 初始定义

浏览器兼容性

更新 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
SVGAElement Chrome Yes Edge 12 Firefox Yes IE 9 Opera Yes Safari Yes WebView Android Yes Chrome Android Yes Firefox Android Yes Opera Android Yes Safari iOS Yes Samsung Internet Android Yes
download Chrome No Edge No Firefox Yes IE ? Opera ? Safari ? WebView Android No Chrome Android No Firefox Android Yes Opera Android ? Safari iOS ? Samsung Internet Android No
hreflang Chrome No Edge ≤18 — 79 Firefox 61 IE No Opera No Safari No WebView Android No Chrome Android No Firefox Android 61 Opera Android No Safari iOS No Samsung Internet Android No
ping Chrome No Edge ≤18 — 79 Firefox 61 IE No Opera No Safari No WebView Android No Chrome Android No Firefox Android 61 Opera Android No Safari iOS No Samsung Internet Android No
referrerPolicy Chrome 51 Edge 79 Firefox 52 IE No Opera 38 Safari 11.1 WebView Android 51 Chrome Android 51 Firefox Android 52 Opera Android 41 Safari iOS No Samsung Internet Android 7.2
rel Chrome No Edge ≤18 — 79 Firefox 61 IE No Opera No Safari No WebView Android No Chrome Android No Firefox Android 61 Opera Android No Safari iOS No Samsung Internet Android No
relList Chrome No Edge ≤18 — 79 Firefox 61 IE No Opera No Safari No WebView Android No Chrome Android No Firefox Android 61 Opera Android No Safari iOS No Samsung Internet Android No
target Chrome Yes Edge 12 Firefox Yes IE 9 Opera Yes Safari Yes WebView Android Yes Chrome Android Yes Firefox Android Yes Opera Android Yes Safari iOS Yes Samsung Internet Android Yes
text Chrome No Edge ≤18 — 79 Firefox 61 IE No Opera No Safari No WebView Android No Chrome Android No Firefox Android 61 Opera Android No Safari iOS No Samsung Internet Android No
type Chrome No Edge ≤18 — 79 Firefox 61 IE No Opera No Safari No WebView Android No Chrome Android No Firefox Android 61 Opera Android No Safari iOS No Samsung Internet Android No

图例

完整支持
完整支持
不支持
不支持
兼容性未知
兼容性未知

另请参阅

  1. SVGAElement
  2. 特性
    1. target
  3. 继承:
    1. SVGGraphicsElement
    2. SVGElement
    3. Element
    4. Node
    5. EventTarget
  4. Related pages for SVG
    1. SVGAltGlyphElement
    2. SVGAngle
    3. SVGAnimateColorElement
    4. SVGAnimateElement
    5. SVGAnimateMotionElement
    6. SVGAnimateTransformElement
    7. SVGAnimatedAngle
    8. SVGAnimatedBoolean
    9. SVGAnimatedEnumeration
    10. SVGAnimatedInteger
    11. SVGAnimatedLength
    12. SVGAnimatedLengthList
    13. SVGAnimatedNumber
    14. SVGAnimatedNumberList
    15. SVGAnimatedPathData
    16. SVGAnimatedPoints
    17. SVGAnimatedPreserveAspectRatio
    18. SVGAnimatedRect
    19. SVGAnimatedString
    20. SVGAnimatedTransformList
    21. SVGAnimationElement
    22. SVGCircleElement
    23. SVGClipPathElement
    24. SVGComponentTransferFunctionElement
    25. SVGCursorElement
    26. SVGDefsElement
    27. SVGDescElement
    28. SVGDocument
    29. SVGElement
    30. SVGEllipseElement
    31. SVGFEBlendElement
    32. SVGFEColorMatrixElement
    33. SVGFEComponentTransferElement
    34. SVGFECompositeElement
    35. SVGFEConvolveMatrixElement
    36. SVGFEDiffuseLightingElement
    37. SVGFEDisplacementMapElement
    38. SVGFEDistantLightElement
    39. SVGFEDropShadowElement
    40. SVGFEFloodElement
    41. SVGFEFuncAElement
    42. SVGFEFuncBElement
    43. SVGFEFuncGElement
    44. SVGFEFuncRElement
    45. SVGFEGaussianBlurElement
    46. SVGFEImageElement
    47. SVGFEMergeElement
    48. SVGFEMergeNodeElement
    49. SVGFEMorphologyElement
    50. SVGFEOffsetElement
    51. SVGFEPointLightElement
    52. SVGFESpecularLightingElement
    53. SVGFESpotLightElement
    54. SVGFETileElement
    55. SVGFETurbulenceElement
    56. SVGFilterElement
    57. SVGFilterPrimitiveStandardAttributes
    58. SVGFitToViewBox
    59. SVGFontElement
    60. SVGFontFaceElement
    61. SVGFontFaceFormatElement
    62. SVGFontFaceNameElement
    63. SVGFontFaceSrcElement
    64. SVGFontFaceUriElement
    65. SVGForeignObjectElement
    66. SVGGElement
    67. SVGGlyphElement
    68. SVGGradientElement
    69. SVGGraphicsElement
    70. SVGHKernElement
    71. SVGImageElement
    72. SVGLength
    73. SVGLengthList
    74. SVGLineElement
    75. SVGLinearGradientElement
    76. SVGMPathElement
    77. SVGMarkerElement
    78. SVGMaskElement
    79. SVGMatrix
    80. SVGMetadataElement
    81. SVGMissingGlyphElement
    82. SVGNumber
    83. SVGNumberList
    84. SVGPathElement
    85. SVGPathSeg
    86. SVGPathSegArcAbs
    87. SVGPathSegArcRel
    88. SVGPathSegClosePath
    89. SVGPathSegCurvetoCubicAbs
    90. SVGPathSegCurvetoCubicRel
    91. SVGPathSegCurvetoCubicSmoothAbs
    92. SVGPathSegCurvetoCubicSmoothRel
    93. SVGPathSegCurvetoQuadraticAbs
    94. SVGPathSegCurvetoQuadraticRel
    95. SVGPathSegCurvetoQuadraticSmoothAbs
    96. SVGPathSegCurvetoQuadraticSmoothRel
    97. SVGPathSegLinetoAbs
    98. SVGPathSegLinetoHorizontalAbs
    99. SVGPathSegLinetoHorizontalRel
    100. SVGPathSegLinetoRel
    101. SVGPathSegLinetoVerticalAbs
    102. SVGPathSegLinetoVerticalRel
    103. SVGPathSegList
    104. SVGPathSegMovetoAbs
    105. SVGPathSegMovetoRel
    106. SVGPatternElement
    107. SVGPoint
    108. SVGPointList
    109. SVGPolygonElement
    110. SVGPolylineElement
    111. SVGPreserveAspectRatio
    112. SVGRadialGradientElement
    113. SVGRect
    114. SVGRectElement
    115. SVGSVGElement
    116. SVGScriptElement
    117. SVGSetElement
    118. SVGStopElement
    119. SVGStringList
    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