We want to help developers like you. Tell us about how you work: http://qsurvey.mozilla.com/s3/Developer-Audience-Survey-V2/?s=mdn

The switch 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

CategoriesContainer element
Permitted contentAny number of the following elements, in any order:
Animation elements
Descriptive elements
Shape elements
<a>, <foreignObject>, <g>, <image>, <svg>, <switch>, <text>, <use>

Example

Attributes

Global attributes

Specific attributes

DOM Interface

This element implements the SVGSwitchElement interface.

Specifications

Specification Status Comment
Scalable Vector Graphics (SVG) 2
The definition of '<switch>' in that specification.
Working Draft  
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 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 Not supported ? 3.0.4

The chart is based on these sources.

Document Tags and Contributors

 Contributors to this page: Sebastianz, kscarfone, Jeremie, trevorh, Manuel_Strehl, Longsonr
 Last updated by: Sebastianz,