Unsere Freiwilligen haben diesen Artikel noch nicht in Deutsch übersetzt. Machen Sie mit und helfen Sie, das zu erledigen!
The <switch>
SVG element evaluates the requiredFeatures
, requiredExtensions
and systemLanguage
attributes on its direct child elements in order, and then processes and renders the first child for which these attributes evaluate to true. All others will be bypassed and therefore not rendered. If the child element is a container element such as a <g>
, then the entire subtree is either processed/rendered or bypassed/not rendered.
Note that the values of properties display
and visibility
have no effect on switch
element processing. In particular, setting display
to none on a child of a switch
element has no effect on true/false testing associated with switch
element processing.
Usage context
Categories | Container element |
---|---|
Permitted content | Any number of the following elements, in any order: Animation elements Descriptive elements Shape elements <a> , <foreignObject> , <g> , <image> , <svg> , <switch> , <text> , <use> |
Attributes
Global attributes
- Conditional processing attributes
- Core attributes
- Graphical event attributes
- Presentation attributes
class
style
externalResourcesRequired
transform
DOM Interface
This element implements the SVGSwitchElement
interface.
Specifications
Specification | Status | Comment |
---|---|---|
Scalable Vector Graphics (SVG) 2 The definition of '<switch>' in that specification. |
Candidate Recommendation | Clarified the evaluation of the systemLanguage attribute |
Scalable Vector Graphics (SVG) 1.1 (Second Edition) The definition of '<switch>' in that specification. |
Recommendation | Initial definition |
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | 1.0 | 1.8[1] | 9.0 | 8.0 | 3.0.4 |
Feature | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | 3.0 | ? | 1.8[1] | No support | ? | 3.0.4 |
[1] Starting with Firefox 50 (Firefox 50.0 / Thunderbird 50.0 / SeaMonkey 2.47) and the latest SVG specification, the allowReorder
attribute has been dropped and the behavior it was setting is now the default.
The chart is based on these sources.