W3C home > Mailing lists > Public > public-svg-wg@w3.org > January to March 2014

svg2: Ensure IDL attributes aren't defined using 'partial interface D...

From: SVG Working Group repository <cam+svgwgrepo@mcc.id.au>
Date: Sat, 01 Feb 2014 21:33:49 -0800
Message-Id: <hg.8efbddd72d71.1391319229.3034738116371802840@ps58493.dreamhostps.com>
To: public-svg-wg@w3.org
details:   https://svgwg.org/hg/svg2/rev/8efbddd72d71
changeset: 596:8efbddd72d71
user:      Cameron McCormack <cam@mcc.id.au>
date:      Sun Feb 02 16:31:52 2014 +1100
Ensure IDL attributes aren't defined using 'partial interface Document' unless the implementation does not also implement HTML.


 master/struct.html           |  100 +++++++++++++++++-------------------------
 master/style/default_svg.css |    1 +
 2 files changed, 41 insertions(+), 60 deletions(-)

diffs (147 lines):

diff --git a/master/struct.html b/master/struct.html
--- a/master/struct.html
+++ b/master/struct.html
@@ -1911,82 +1911,62 @@ such as when an HTML document has an <sp
 element whose <span class="attr-name">'href'</span> attribute references an SVG
 document (i.e., a document whose MIME type is "image/svg+xml"
 and whose root element is thus an <a>'svg'</a> 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.
-<p class="issue">HTML defines title, referrer and domain.  We should remove
-them and file a bug on HTML to ensure that title does the right thing for
-SVG documents.</p>
 <p>For historical reasons, <a>Window</a> objects must also have a writable, configurable,
 non-enumerable property named SVGDocument whose value is the <a>Document</a> interface object.</p>
 <pre class="idl">partial interface <a>Document</a> {
-  readonly attribute DOMString <a href="struct.html#__svg__SVGDocument__title">title</a>;
-  readonly attribute DOMString <a href="struct.html#__svg__SVGDocument__referrer">referrer</a>;
-  readonly attribute DOMString <a href="struct.html#__svg__SVGDocument__domain">domain</a>;
   readonly attribute <a class="idlinterface" href="struct.html#InterfaceSVGSVGElement">SVGSVGElement</a> <a href="struct.html#__svg__SVGDocument__rootElement">rootElement</a>;
+<dl class="interface">
+  <dt class="attributes-header">Attributes:</dt>
+  <dd>
+    <dl class="attributes">
+      <dt id="__svg__SVGDocument__rootElement" class="attribute first-child"><b>rootElement</b><span class="idl-type-parenthetical"> (readonly <a class="idlinterface" href="struct.html#InterfaceSVGSVGElement">SVGSVGElement</a>)</span></dt>
+      <dd class="attribute">
+        <div>
+          The root <a>'svg'</a> in the document hierarchy.
+          This attribute is deprecated, and may be removed in a future svg specification.
+          Authors are encouraged to use the <a href="http://www.w3.org/TR/dom/#dom-document-documentelement">documentElement</a> attribute in Document instead.
+        </div>
+      </dd>
+    </dl>
+  </dd>
+<p>The following IDL fragment must be supported only if the SVG implementation is also a
+<a href="http://www.w3.org/TR/html/infrastructure.html#interactive">Web browser or other interactive user agent</a>,
+and therefore implements HTML.</p>
+<pre class="idl"><span class='comment'>// must only be implemented in certain implementations</span>
+partial interface <a>Document</a> {
+  readonly attribute DOMString title;
+  readonly attribute DOMString referrer;
+  readonly attribute DOMString domain;
   readonly attribute Element? <a href="struct.html#__svg__SVGDocument__activeElement">activeElement</a>;
-};</pre><dl class="interface">
-<dt class="attributes-header">Attributes:</dt>
-<dl class="attributes">
-<dt id="__svg__SVGDocument__title" class="attribute first-child"><b>title</b><span class="idl-type-parenthetical"> (readonly DOMString)</span></dt>
-<dd class="attribute">
-The title of a document as specified by the <a>'title'</a> sub-element of
-the <a>'svg'</a> root element (i.e.,
-<span class="code-fragment">&lt;svg&gt;&lt;title&gt;Here is the title&lt;/title&gt;...&lt;/svg&gt;</span>)
-<dt id="__svg__SVGDocument__referrer" class="attribute"><b>referrer</b><span class="idl-type-parenthetical"> (readonly DOMString)</span></dt>
-<dd class="attribute">
-Returns the URI of the page that linked to this page. The value is an
-empty string if the user navigated to the page directly (not through a
-link, but, for example, via a bookmark).
-<dt id="__svg__SVGDocument__domain" class="attribute"><b>domain</b><span class="idl-type-parenthetical"> (readonly DOMString)</span></dt>
-<dd class="attribute">
-The domain name of the server that served the document, or a null string
-if the server cannot be identified by a domain name.
-<dt id="__svg__SVGDocument__rootElement" class="attribute"><b>rootElement</b><span class="idl-type-parenthetical"> (readonly <a class="idlinterface" href="struct.html#InterfaceSVGSVGElement">SVGSVGElement</a>)</span></dt>
-<dd class="attribute">
-The root <a>'svg'</a> in the document hierarchy.
-This attribute is deprecated, and may be removed in a future svg specification.
-Authors are encouraged to use the <a href="http://www.w3.org/TR/dom/#dom-document-documentelement">documentElement</a> attribute in Document instead.
-<dt id="__svg__SVGDocument__activeElement" class="attribute"><b>activeElement</b><span class="idl-type-parenthetical"> (readonly Element)</span></dt>
-<dd class="attribute">
-The activeElement attribute must return the element in the document that is focused. If no element in the Document is focused, this must return the <a href="http://www.w3.org/TR/dom/#dom-document-documentelement">documentElement</a>.
+<p class='note'>This is because the interface members below are already defined in HTML,
+and in implementations that support SVG and HTML we they cannot be duplicated.</p>
+<p>The title, referrer, domain and activeElement IDL attributes must behave the same as
+<a href="http://www.w3.org/TR/html/dom.html#document">the corresponding IDL attributes defined in HTML</a>.</p>
+<p class='issue'>Issues have been filed on HTML so that title and activeElement work
+on SVG documents (by looking at <a>'title'</a> elements in the SVG namespace,
+and by defaulting to the root <a>'svg'</a> element rather than the <span class='element-name'>body</span>
+element, respectively).</p>
 <h3 id="InterfaceSVGSVGElement">Interface SVGSVGElement</h3>
 <edit:with element='svg'>
 <p>A key interface definition is the <a>SVGSVGElement</a> interface,
diff --git a/master/style/default_svg.css b/master/style/default_svg.css
--- a/master/style/default_svg.css
+++ b/master/style/default_svg.css
@@ -96,16 +96,17 @@ div.element-summary {
 .expander:hover { background: #ffa }
 .expander:after { content: 'show ยป' }
 .xgrammar { color: #A52A2A; font-family: monospace; font-size: 90% }
 pre.idl, pre.dtd-fragment { color: black; padding: 1em; margin-top: 1em; margin-left: 0; font-size: 1em; overflow: auto; font-size: 14px }
 pre.idl { background: #d9e8ff }
 pre.idl a:link, pre.idl a:visited { color: black; }
+pre.idl .comment { color: #005A9C; }
 dl.interface dt {
   margin-top: 1em;
 dl.interface dt.attribute,
 dl.interface dt.constant,
 dl.interface dt.operation {
Received on Sunday, 2 February 2014 05:34:13 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:29:55 UTC