switch
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2015年7月.
switch元素对它的直接子元素上的属性requiredFeatures、属性requiredExtensions 和 属性systemLanguage按照顺序进行评估,然后处理和呈现第一个评估为true的子元素。其他子元素会被绕过不会被呈现。如果某个子元素是容器元素比如说是一个<g>元素,那么整个子树会被处理呈现或者全部绕过不呈现。
注意:属性display和属性visibility的值对switch 元素处理是不起作用的。特别是,在switch 元素的子元素上设置display为 none,对switch 元素的 true/false 测试处理不起作用。