Donner SVG 0.8.0
0.8.0 ยท ebf353960.8.0 main
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
<switch>

Conditional processing container: renders the first matching direct child, ranking any language-conditioned children before it by the user's preferred languages.

The <switch> element ranks its direct children carrying systemLanguage by the priority order configured with SVGDocument::setUserLanguages (matching SVG2's allowReorder=yes behavior) and renders the best match, tie-breaking by document order. A child without systemLanguage matches at its document position; later children cannot displace it. Authors can place an unconditional child last to use it as a fallback. The SVG 2 rule applies whether or not the historical allowReorder attribute is present. Unknown (non-SVG) child elements are never selected.

Donner evaluates systemLanguage against the user's preferred languages (default en, see SVGDocument::setUserLanguages), treats a non-empty requiredExtensions list as unsupported, and ignores requiredFeatures because SVG2 deprecates it.

Aside from child selection, <switch> behaves like <g>; attributes such as transform and fill set on it apply to the rendered child.

Attributes

<switch> has no element-specific attributes of its own. It uses standard SVG presentation attributes plus the common conditional-processing attributes requiredFeatures, requiredExtensions, and systemLanguage.

<switch>
<rect width="100" height="100" fill="red" requiredExtensions="http://example.org/bogus" />
<rect width="100" height="100" fill="green" />
</switch>