Donner SVG Editor & Engine
SVG-native editor and embeddable SVG2 + CSS3 engine in C++20, with GPU (WebGPU) and compact CPU renderers, built for correctness, security, and performance.
Loading...
Searching...
No Matches
<switch>

Conditional processing container: renders only the first direct child whose conditional-processing attributes all evaluate to true.

The <switch> element evaluates the conditional-processing attributes on each of its direct children in document order, and renders the first child for which all of them evaluate to true. Children without conditional attributes evaluate to true, so a final unconditional child acts as a fallback. Unknown (non-SVG) child elements are never selected.

Donner evaluates systemLanguage against the default user language en, 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>