XML technologies / SVG / Adding hyperlinks and external files / Using external files correctly / The switch tag

(Excerpt from “Das Einsteigerseminar SVG — Webgrafiken mit XML” by Helma Spona)

External files or SVG tags and attributes unsupported by some browsers or plug-ins present a problem: code works correctly only when all requirements are met. Unsupported features may impair the image’s quality.

SVG’s <switch> tag can prevent a graphic, group or element from displaying when requirements are unmet. Define the conditions with its attributes and place the affected elements inside it.

All attributes work alike. Assign a single required feature or a list. The plug-in or browser checks that each feature or extension is available. Only if all are available does the attribute evaluate to the Boolean value (true). When all attributes evaluate to true, the contents of the <switch> tag are executed and rendered.

The tag supports these attributes:

Note:
Adobe SVG Viewer currently supports only the attribute requiredExtensions, so the others have no practical role yet.

The table explains values for the attribute requiredFeatures.

Table: Values for the attribute requiredFeatures of the <switch> tag.

Value

Meaning

org.w3c.svg

Requires support for at least one feature, org.w3c.svg.dynamic or org.w3c.svg.static.

org.w3c.svg.static

Requires correct execution of all static SVG elements, including paths, rectangles, circles, groups and filters.

org.w3c.dom.svg.static

Requires all SVG elements defined by org.w3c.svg.static to be script-accessible through the DOM (Document Object Model).

org.w3c.svg.animation

Requires, in addition to the static elements defined by org.w3c.svg.static, support for the <animate> tag.

org.w3c.dom.svg.animation

Requires all SVG elements defined by org.w3c.svg.animation to be script-accessible through the DOM.

org.w3c.svg.dynamic

Requires, in addition to features defined by org.w3c.svg.dynamic, support for events.

org.w3c.svg.all

Requires support for all SVG specification attributes and tags.

org.w3c.dom.svg.all

Requires support for all SVG specification attributes and tags, accessible to scripts through the DOM.

   

 

 

 

back to top