19 Extensibility

Contents

19.1 Foreign namespaces and private data

SVG allows inclusion of elements from foreign namespaces
anywhere with the SVG content. In general, the SVG user agent
will include the unknown elements in the DOM but will otherwise
ignore unknown elements. (The notable exception is described
under Embedding Foreign Object
Types.)

Extension elements in the SVG namespace must not be used.

Additionally, SVG allows inclusion of attributes from
foreign namespaces on any SVG element. The SVG user agent will
include unknown attributes in the DOM but will otherwise ignore
unknown attributes.Unprefixed attributes on elements in the SVG namespace must
not be used for extensions.

SVG's ability to include foreign namespaces can be used for
the following purposes:

Application-specific information so that authoring
applications can include model-level data in the SVG content
to serve their "roundtripping" purposes (i.e., the ability to
write, then read a file without loss of higher-level
information).

Supplemental data for extensibility. For example, suppose
you have an extrusion extension which takes any 2D graphics
and extrudes it in three dimensions. When applying the
extrusion extension, you probably will need to set some
parameters. The parameters can be included in the SVG content
by inserting elements from an extrusion extension
namespace.

To illustrate, a business graphics authoring application
might want to include some private data within an SVG document
so that it could properly reassemble the chart (a pie chart in
this case) upon reading it back in:

19.2 Embedding foreign object types

One goal for SVG is to provide a mechanism by which other
XML language processors can render into an area within an SVG
drawing, with those renderings subject to the various
transformations and compositing parameters that are currently
active at a given point within the SVG content tree. One
particular example of this is to provide a frame for XML
content styled with CSS or XSL so that dynamically reflowing
text (subject to SVG transformations and compositing) could be
inserted into the middle of some SVG content. Another example
is inserting a MathML expression into
an SVG drawing.

The 'foreignObject'
element allows for inclusion of a foreign namespace which has
its graphical content drawn by a different user agent. The
included foreign graphical content is subject to SVG
transformations and compositing.

The user agent must treat all of the content
within a 'foreignObject' as foreign content which is to be handed
off to an appropriate content handler for rendering.
User agents are not required
to support any particular content types via
'foreignObject'. In particular, user agents
are not required to support
SVG content embedded within or referenced by 'foreignObject';
SVG content within 'foreignObject' represents an extension
just as with any other type of content.

Usually, a 'foreignObject'
will be used in conjunction with the 'switch' element and the requiredExtensions attribute to
provide proper checking for user agent support and provide an
alternate rendering in case user agent support is not
available.

19.2.1 The 'foreignObject' element

The 'foreignObject' element is
an extensibility point which allows user agents to offer graphical
rendering features beyond those which are defined within this
specification.

A conformant SVG user agent is not required to support any
particular foreign namespace content within 'foreignObject' itself
nor is it required to invoke other user agents to handle particular
embedded foreign object types. Ultimately, it is expected that
Web browsers will support the ability for SVG to embed
content from other XML grammars which use CSS or XSL to format their
content, with the resulting CSS- or XSL-formatted content then
subject to SVG transformations and compositing. At this time, such a
capability is not a requirement. The CDF Working Group is expected to
provide this functionality.

The rendered content of a foreignObject must be treated
as atomic from the point of view of SVG compositing and
transformation, as if it was a single replaced element.

All MouseEvents that are dispatched to a
'foreignObject' element, including mouse events that bubble from the
embedded content, must have their clientX/clientY attributes adjusted so
that they represent values within the initial viewport coordinate system.

The x-axis coordinate of one corner of the rectangular
region into which the graphics associated with the contents
of the 'foreignObject'
will be rendered.
If the attribute is not specified, the effect is as if a
value of "0" were specified.Animatable:
yes.

The y-axis coordinate of one corner of the rectangular
region into which the referenced document is placed.
If the attribute is not specified, the effect is as if a
value of "0" were specified.Animatable:
yes.

The width of the rectangular region into which the
referenced document is placed.
A negative value is unsupported.
A value of zero disables rendering of the element. If the attribute is not specified, the effect is as if a
value of "0" were specified.Animatable:
yes.