Re: ISSUE-2147 (external-refs confusing): Section on externally referenced documents confusing [Last Call: SVG 1.2 Tiny ]

On Thu, 30 Oct 2008 07:34:47 +0100, Cameron McCormack <cam@mcc.id.au> wrote:

...
> Having said that, here is some proposed text that takes a bit of wording
> from Cyril’s and Doug’s proposals, and a fair bit of my own:
>
>   Processing of external references to SVG documents
>
>   When an SVG user agent resolves an external reference to an SVG
>   document, how the document is loaded and processed depends on how the
>   document was referenced.  As defined below, an externally referenced
>   SVG document or document fragment is classified as either a primary
>   document or a resource document, and this classification determines
>   the document’s processing.
>
>   A primary document is an SVG document that is referenced, or an SVG
>   document fragment that is included in another document, that is to be
>   presented in whole by the user agent.  Specifically, the following are
>   classified as primary documents:
>
>     * An entire SVG document that is loaded into an SVG user agent
>       for presentation, such as when navigating a web browser to an IRI
>       that references an SVG document, whether by typing the IRI into
>       the browser’s address bar, clicking on a link to that IRI, or
>       having the Location.assign() method invoked.  (In an HTML 5 user
>       agent, this is when an SVG document is part of a top-level
>       browsing context ([HTML5], section 4.1).)
>
>     * An entire SVG document that is loaded due to it being referenced
>       by an 'animation' element.
>
>     * An entire SVG document that is loaded due to it being referenced
>       for inclusion by a parent non-SVG document for presentation, such
>       as using the HTML 'object' or 'iframe' elements.
>
>     * An SVG document fragment that is embedded within a non-SVG
>       document that is being presented by the user agent, such as an
>       XHTML document that has an 'svg' element child of an HTML 'div'
>       element.  While the SVG document fragment is not a whole document
>       in itself, it does act as a primary document for the processing
>       purposes described below, and is distinct from any other primary
>       document that may be embedded within the non-SVG document.
>
>   A resource document is an SVG document that has been loaded because it
>   is referenced as a resource by an SVG document fragment.
>   Specifically, the following kinds of external references, all of which
>   are references to elements, will cause the loaded SVG document to be
>   classified as a resource document:
>
>     * The 'xlink:href' attribute on a 'use' element
>     * The 'xlink:href' attribute on a 'font-face-uri' element
>     * A paint server reference in a 'fill' or 'stroke' property
>
>   Each primary document maintains a dictionary that maps IRIs to
>   resource documents.  This dictionary is used whenever a resource
>   document is to be loaded because the primary document or one of its
>   resource documents references it.  Before loading a resource document,
>   its IRI is first looked up in the primary document’s dictionary to
>   determine if it has already been loaded.  If so, then that
>   already-loaded document is used instead of creating a separate
>   document instance.  Thus, for each primary document, a given resource
>   document is loaded only once.  Primary documents, however, are always
>   separate, self-contained document instances, and resource documents
>   are not shared between primary documents.

I disagree with this, and I think similar wording is also in the other proposal and in the spec currently. Specifically I'd like the spec to avoid requiring reloading of the same resource if the primary documents are in the same document (the inline in XHTML case). 

One solution could be to remove the mention of the document fragment case and to fix that in a later spec. Another would be to say that a primary document is the document itself, and this would also work for the other cases since they would all establish a new document. Yet another would be to add a sentence saying that resource documents may be shared among primary documents if the primary documents are inline in the same document.

...
> And a question: should resource documents be restricted to being entire
> SVG documents, or can they be SVG document fragments within say an XHTML
> document?

Any document capable of providing the necessary svg elements (in the proper namespace) should be allowed as the container IMHO. This wouldn't rule out HTML5 documents, if the elements were put in the DOM correctly.

Cheers
/Erik

-- 
Erik Dahlstrom, Core Technology Developer, Opera Software
Co-Chair, W3C SVG Working Group
Personal blog: http://my.opera.com/macdev_ed

Received on Thursday, 30 October 2008 08:27:08 UTC