This attribute takes a list of feature strings, with the individual strings separated by white space. It determines whether or not all of the named features are supported by the browser; if all of them are supported, the attribute evaluates to true
end the element is rendered; otherwise, the attribute evaluates to false
and the current element and its children are skipped and thus will not be rendered. This provides a way to design SVG that gracefully falls back when features aren't available.
If the attribute is not present, then its implicit evaluated value is true
. If a null string or empty string value is given to attribute requiredFeatures
, the attribute is evaluate to false
.
requiredFeatures
is often used in conjunction with the <switch>
element. If requiredFeatures
is used in other situations, it represents a simple switch on the given element whether to render the element or not.
If you need to detect availability of an SVG feature from script, you can use the DOMImplementation.hasFeature()
method.
Categories | Conditional processing attribute |
---|---|
Value | <list-of-features> |
Animatable | No |
Normative document | SVG 1.1 (2nd Edition) |
The following are the feature strings for the requiredFeatures
attribute. These same feature strings apply to the hasFeature method call that is part of the SVG DOM's support for the DOMImplementation
interface. In some cases the feature strings map directly to a set of attributes, properties or elements, in others they represent some functionality of the browser. Note that the format and naming for feature strings changed from SVG 1.0 to SVG 1.1. The SVG 1.0 feature strings are not listed here but can be found in the SVG Specification. Some browser support SVG 1.0 Feature strings for compatibility reasons. However, the SVG 1.0 feature strings are considered deprecated.
At least one of the following feature is supported:
At least one of the following feature is supported:
The browser supports all the following features:
The browser supports all of the DOM interfaces and methods that correspond to the language features for http://www.w3.org/TR/SVG11/feature#SVG-static.
The browser supports all of the language features from http://www.w3.org/TR/SVG11/feature#SVG-static plus the feature http://www.w3.org/TR/SVG11/feature#Animation.
The browser supports all of the DOM interfaces and methods that correspond to the language features for http://www.w3.org/TR/SVG11/feature#SVG-animation.
The browser supports all of the language features from http://www.w3.org/TR/SVG11/feature#SVG-animation plus the following features:
The browser supports all of the DOM interfaces and methods that correspond to the language features for http://www.w3.org/TR/SVG11/feature#SVG-dynamic.
The browser supports the id
, xml:base
, xml:lang
and xml:space
attributes
The browser supports <svg>
, <g>
, <defs>
, <desc>
, <title>
, <metadata>
, <symbol>
and <use>
elements.
The browser supports <svg>
, <g>
, <defs>
, <desc>
, <title>
, <metadata>
and <use>
elements.
The browser supports the enable-background
attribute
The browser supports the <switch>
element, and the requiredFeatures
, requiredExtensions
, systemLanguage
attributes
The browser supports the <image>
element.
The browser supports the <style>
element.
The browser supports the <rect>
, <circle>
, <line>
, <polyline>
, <polygon>
, <ellipse>
and <path>
elements.
The browser supports the <text>
, <tspan>
, <tref>
, <textPath>
, <altGlyph>
, <altGlyphDef>
, <altGlyphItem>
and <glyphRef>
elements.
The browser supports the <text>
element
The browser supports the color
, fill
, fill-rule
, stroke
, stroke-dasharray
, stroke-dashoffset
, stroke-linecap
, stroke-linejoin
, stroke-miterlimit
, stroke-width
, color-interpolation
and color-rendering
attributes
The browser supports the color
, fill
, fill-rule
, stroke
, stroke-dasharray
, stroke-dashoffset
, stroke-linecap
, stroke-linejoin
, stroke-miterlimit
, stroke-width
and color-rendering
attributes
The browser supports the opacity
, stroke-opacity
and fill-opacity
attributes
The browser supports the display
, image-rendering
, pointer-events
, shape-rendering
, text-rendering
and visibility
attributes
The browser supports the display
and visibility
attributes
The browser supports the <marker>
element
The browser supports the <color-profile>
element
The browser supports the <linearGradient>
, <radialGradient>
and <stop>
elements
The browser supports the <pattern>
element
The browser supports the <clipPath>
element and the clip-path
, clip-rule
attributes
The browser supports the <clipPath>
element and the clip-path
attribute
The browser supports the <mask>
element
The browser supports the <filter>
, <feBlend>
, <feColorMatrix>
, <feComponentTransfer>
, <feComposite>
, <feConvolveMatrix>
, <feDiffuseLighting>
, <feDisplacementMap>
, <feFlood>
, <feGaussianBlur>
, <feImage>
, <feMerge>
, <feMergeNode>
, <feMorphology>
, <feOffset>
, <feSpecularLighting>
, <feTile>
, <feDistantLight>
, <fePointLight>
, <feSpotLight>
, <feFuncR>
, <feFuncG>
, <feFuncB>
and <feFuncA>
elements
The browser supports the <filter>
, <feBlend>
, <feColorMatrix>
, <feComponentTransfer>
, <feComposite>
, <feFlood>
, <feGaussianBlur>
, <feImage>
, <feMerge>
, <feMergeNode>
, <feOffset>
, <feTile>
, <feFuncR>
, <feFuncG>
, <feFuncB>
and <feFuncA>
elements
The browser supports the onunload
, onabort
, onerror
, onresize
, onscroll
and onzoom
attributes
The browser supports the onfocusin
, onfocusout
, onactivate
, onclick
, onmousedown
, onmouseup
, onmouseover
, onmousemove
, onmouseout
and onload
attributes
The browser supports the onbegin
, onend
, onrepeat
and onload
attributes
The browser supports the <cursor>
element
The browser supports the <a>
element
The browser supports the xlink:type
, xlink:href
, xlink:role
, xlink:arcrole
, xlink:title
, xlink:show
and xlink:actuate
attributes
The browser supports the externalResourcesRequired
attribute
The browser supports the <view>
element
The browser supports the <script>
element
The browser supports the <animate>
, <set>
, <animateMotion>
, <animateTransform>
, <animateColor>
and <mpath>
elements
The browser supports the <font>
, <font-face>
, <glyph>
, <missing-glyph>
, <hkern>
, <vkern>
, <font-face-src>
, <font-face-uri>
, <font-face-format>
and <font-face-name>
elements
The browser supports the <font>
, <font-face>
, <glyph>
, <missing-glyph>
, <hkern>
, <font-face-src>
and <font-face-name>
elements
The browser supports the <foreignObject>
element
Source code | Output result |
---|---|
Unable to find file requiredFeatures.svg | Unable to find file requiredFeatures.svg |
Desktop | ||||||
---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
Basic support | ? | ? | ? | ? | ? | ? |
Mobile | |||||||
---|---|---|---|---|---|---|---|
Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
Basic support | ? | ? | ? | ? | ? | ? | ? |
The following elements can use the requiredFeatures
attribute
<a>
<clipPath>
<cursor>
<defs>
<foreignObject>
<g>
<mask>
<pattern>
<svg>
<switch>
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/requiredFeatures