W3C home > Mailing lists > Public > www-svg@w3.org > December 2002

SVG 1.2 - SvgWindow And SvgDocument

From: Don XML <don_xml@hotmail.com>
Date: Tue, 10 Dec 2002 15:08:56 -0500
To: www-svg@w3.org
Message-ID: <F130kYfzjsBxnwCfJ5i0001907e@hotmail.com>

The SVG# group has been working on implementing the 1.2 SvgWindow interface 
proposal, and we are running into some conceptual issues that I hope some on 
the list can help with.

First, here is the definition of the SvgDocument from 1.1:

5.17 DOM interfaces

Interface SVGDocument
When an 'svg' element is embedded inline as a component of a document from 
another namespace, such as when an 'svg' element is embedded inline within 
an XHTML document [XHTML], then an SVGDocument object will not exist; 
instead, the root object in the document object hierarchy will be a Document 
object of a different type, such as an HTMLDocument object.

However, an SVGDocument object will indeed exist when the root element of 
the XML document hierarchy is an 'svg' element, such as when viewing a 
stand-alone SVG file (i.e., a file with MIME type "image/svg+xml"). In this 
case, the SVGDocument object will be the root object of the document object 
model hierarchy.

In the case where an SVG document is embedded by reference, such as when an 
XHTML document has an 'object' element whose href attribute references an 
SVG document (i.e., a document whose MIME type is "image/svg+xml" and whose 
root element is thus an 'svg' element), there will exist two distinct DOM 
hierarchies. The first DOM hierarchy will be for the referencing document 
(e.g., an XHTML document). The second DOM hierarchy will be for the 
referenced SVG document. In this second DOM hierarchy, the root object of 
the document object model hierarchy is an SVGDocument object.

The SVGDocument interface contains a similar list of attributes and methods 
to the HTMLDocument interface described in the Document Object Model (HTML)
Level 1 chapter of the [DOM1] specification.

And here's the definition of the SvgWindow object from the 1.2 WD:

7.4 Window Interface
The majority of scripted SVG documents in existence make use of the browser 
specific Window interface, which includes methods such as setTimeout and 
clearInterval. SVG 1.2 will most likely specify an SVGWindow interface, 
taking into account the defacto standard that already exists.

A method will be added to the SVGDocument interface to enable access to the 
SVGWindow interface. The following is the current proposed Window interface 
in IDL.

Interface SVGWindow
Interface SVGWindow provides a global object for scripts embedded in a SVG 


Here are a couple problems we are having:

1) What is the root object of an SVG object?  Is it the SvgDocument? or the 
SvgWindow? or something new?  The SVG# team has gone round and round on this 
issue, and I seem to think that we need something new, but more on that 

2) If an SvgDocument doesn’t have to exist (i.e if the SVG is inline with 
XHTML), how do you get a reference to the SvgWindow if you can only get to 
it off the SvgDocument?  The SvgWindow still needs to exist, even if the 
SvgDocument does not.  IMHO we need something like a SvgDocumentFragment 
which is associated with a SvgWindow.  This way no matter if the SVG element 
is the root object of the document, just a document fragment contained 
within a document that has a root element of another namespace, or a 
document fragment contained within a SvgDocument, everything works the same. 
  The SvgWindow describes the box (or canvas) that the associated 
SvgDocumentFragment can be rendered in.  To me, this model seems to be more 
compliant with the CSS Box model.


Always listen to experts. They'll tell you what can't be done, and why. Then 
do it.

The new MSN 8: smart spam protection and 2 months FREE*  
Received on Tuesday, 10 December 2002 15:09:34 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 March 2017 09:46:54 UTC