Skip to content

Commit

Permalink
[agiow] (0) Define how we create a 'specified CSS element reference i…
Browse files Browse the repository at this point in the history
…dentifier'. This maybe should move from HTML to CSSOM.

git-svn-id: http://svn.whatwg.org/webapps@5695 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Dec 2, 2010
1 parent cc96881 commit 967f95a
Show file tree
Hide file tree
Showing 3 changed files with 460 additions and 25 deletions.
153 changes: 145 additions & 8 deletions complete.html
Expand Up @@ -214,7 +214,7 @@

<header class=head id=head><p><a class=logo href=http://www.whatwg.org/ rel=home><img alt=WHATWG height=101 src=/images/logo width=101></a></p>
<hgroup><h1>Web Applications 1.0</h1>
<h2 class="no-num no-toc">Draft Standard &mdash; 1 December 2010</h2>
<h2 class="no-num no-toc">Draft Standard &mdash; 2 December 2010</h2>
</hgroup><p>You can take part in this work. <a href=http://www.whatwg.org/mailing-list>Join the working group's discussion list.</a></p>
<p><strong>Web designers!</strong> We have a <a href=http://blog.whatwg.org/faq/>FAQ</a>, a <a href=http://forums.whatwg.org/>forum</a>, and a <a href=http://www.whatwg.org/mailing-list#help>help mailing list</a> for you!</p>
<!--<p class="impl"><strong>Implementors!</strong> We have a <a href="http://www.whatwg.org/mailing-list#implementors">mailing list</a> for you too!</p>-->
Expand Down Expand Up @@ -368,9 +368,10 @@ <h2 class="no-num no-toc" id=contents>Table of contents</h2>
<li><a href=#domsettabletokenlist-0><span class=secno>2.8.4 </span>DOMSettableTokenList</a></li>
<li><a href=#safe-passing-of-structured-data><span class=secno>2.8.5 </span>Safe passing of structured data</a></li>
<li><a href=#domstringmap-0><span class=secno>2.8.6 </span>DOMStringMap</a></li>
<li><a href=#dom-feature-strings><span class=secno>2.8.7 </span>DOM feature strings</a></li>
<li><a href=#exceptions><span class=secno>2.8.8 </span>Exceptions</a></li>
<li><a href=#garbage-collection><span class=secno>2.8.9 </span>Garbage collection</a></ol></li>
<li><a href=#domelementmap-0><span class=secno>2.8.7 </span>DOMElementMap</a></li>
<li><a href=#dom-feature-strings><span class=secno>2.8.8 </span>DOM feature strings</a></li>
<li><a href=#exceptions><span class=secno>2.8.9 </span>Exceptions</a></li>
<li><a href=#garbage-collection><span class=secno>2.8.10 </span>Garbage collection</a></ol></li>
<li><a href=#namespaces><span class=secno>2.9 </span>Namespaces</a></ol></li>
<li><a href=#dom><span class=secno>3 </span>Semantics, structure, and APIs of HTML documents</a>
<ol>
Expand Down Expand Up @@ -7903,7 +7904,57 @@ <h4 id=domstringmap-0><span class=secno>2.8.6 </span>DOMStringMap</h4>
</div>


<h4 id=dom-feature-strings><span class=secno>2.8.7 </span>DOM feature strings</h4>
<!--CSSREF-->
<h4 id=domelementmap-0><span class=secno>2.8.7 </span>DOMElementMap</h4>

<p>The <code><a href=#domelementmap>DOMElementMap</a></code> interface represents a set of
name-element mappings. It exposes these using the scripting
language's native mechanisms for property access.</p>

<div class=impl>

<p>When a <code><a href=#domelementmap>DOMElementMap</a></code> object is instantiated, it is
associated with three algorithms, one for getting the list of
name-element mappings, one for mapping a name to a certain element,
and one for deleting mappings by name.</p>

<pre class=idl>interface <dfn id=domelementmap>DOMElementMap</dfn> {
<a href=#dom-domelementmap-nameditem title=dom-DOMElementMap-namedItem>getter</a> DOMString (in DOMString name);
<a href=#dom-domelementmap-setitem title=dom-DOMElementMap-setItem>setter</a> void (in DOMString name, in <a href=#element>Element</a> value);
<a href=#dom-domelementmap-additem title=dom-DOMElementMap-addItem>creator</a> void (in DOMString name, in <a href=#element>Element</a> value);
<a href=#dom-domelementmap-removeitem title=dom-DOMElementMap-removeItem>deleter</a> void (in DOMString name);
};</pre>

<p>The <a href=#supported-property-names>supported property names</a> on a
<code><a href=#domelementmap>DOMElementMap</a></code> object at any instant are the names for
each mapping returned from the algorithm for getting the list of
name-element mappings at that instant.</p>

<p>To <dfn id=dom-domelementmap-nameditem title=dom-DOMElementMap-namedItem>determine the value
of a named property</dfn> <var title="">name</var> in a
<code><a href=#domelementmap>DOMElementMap</a></code>, the user agent must return the element
component of the name-element mapping whose name component is <var title="">name</var> in the list returned by the algorithm for
getting the list of name-element mappings.</p>

<p>To set the value of a <dfn id=dom-domelementmap-additem title=dom-DOMElementMap-addItem>new</dfn> or <dfn id=dom-domelementmap-setitem title=dom-DOMElementMap-setItem>existing</dfn> named property <var title="">name</var> to value <var title="">value</var>, the
algorithm for mapping a name to a certain element must be run,
passing <var title="">name</var> as the name <var title="">value</var> as the element.</p>

<p>To <dfn id=dom-domelementmap-removeitem title=dom-DOMElementMap-removeItem>delete an existing
named property</dfn> <var title="">name</var>, the algorithm for
deleting mappings must be run, passing <var title="">name</var> as
the name component of the mapping to be deleted.</p>

<p class=note>The <code><a href=#domelementmap>DOMElementMap</a></code> interface definition
here is only intended for JavaScript environments. Other language
bindings will need to define how <code><a href=#domelementmap>DOMElementMap</a></code> is to be
implemented for those languages.</p>

</div>
<!--CSSREF-->


<h4 id=dom-feature-strings><span class=secno>2.8.8 </span>DOM feature strings</h4>

<p>DOM3 Core defines mechanisms for checking for interface support,
and for obtaining implementations of interfaces, using <a href=http://www.w3.org/TR/DOM-Level-3-Core/core.html#DOMFeatures>feature
Expand All @@ -7925,7 +7976,7 @@ <h4 id=dom-feature-strings><span class=secno>2.8.7 </span>DOM feature strings</h
</div>


<h4 id=exceptions><span class=secno>2.8.8 </span>Exceptions</h4>
<h4 id=exceptions><span class=secno>2.8.9 </span>Exceptions</h4>

<p>The following are <code><a href=#domexception>DOMException</a></code> codes. <a href=#refsDOMCORE>[DOMCORE]</a></p>

Expand Down Expand Up @@ -7972,7 +8023,7 @@ <h4 id=exceptions><span class=secno>2.8.8 </span>Exceptions</h4>

<div class=impl>

<h4 id=garbage-collection><span class=secno>2.8.9 </span>Garbage collection</h4>
<h4 id=garbage-collection><span class=secno>2.8.10 </span>Garbage collection</h4>

<p>There is an <dfn id=implied-strong-reference>implied strong reference</dfn> from any IDL
attribute that returns a pre-existing object to that object.</p>
Expand Down Expand Up @@ -8097,6 +8148,7 @@ <h4 id=documents-in-the-dom><span class=secno>3.1.1 </span>Documents in the DOM<
NodeList <a href=#dom-document-getelementsbyname title=dom-document-getElementsByName>getElementsByName</a>(in DOMString elementName);
NodeList <a href=#dom-document-getelementsbyclassname title=dom-document-getElementsByClassName>getElementsByClassName</a>(in DOMString classNames);
<!--MD--> NodeList <a href=#dom-document-getitems title=dom-document-getItems>getItems</a>(in optional DOMString typeNames); // <a href=#microdata>microdata</a> <!--WARNING: ALSO DUPLICATED IN MICRODATA SECTION--><!--MD-->
<!--CSSREF--> readonly attribute <a href=#domelementmap>DOMElementMap</a> <a href=#dom-document-csselementmap title=dom-document-cssElementMap>cssElementMap</a>;<!--CSSREF-->

// <a href=#dynamic-markup-insertion>dynamic markup insertion</a>
attribute DOMString <a href=#dom-innerhtml title=dom-innerHTML>innerHTML</a>;
Expand Down Expand Up @@ -8769,6 +8821,85 @@ <h4 id=dom-tree-accessors><span class=secno>3.1.4 </span><dfn>DOM tree accessors
> optional tag name.
-->

<!--CSSREF-->
<hr><dl class=domintro><dt><var title="">element</var> . <code title=dom-document-cssElementMap><a href=#dom-document-csselementmap>cssElementMap</a></code></dt>
<dd>

<p>Returns a <code><a href=#domelementmap>DOMElementMap</a></code> object for the
<code><a href=#document>Document</a></code> representing the current <span title="specified CSS element reference identifier">specified CSS
element reference identifiers</span>.</p>

</dd>

</dl><div class=impl>

<p>The <dfn id=dom-document-csselementmap title=dom-document-cssElementMap><code>cssElementMap</code></dfn>
IDL attribute allows authors to define <span>title="specified CSS
element reference identifier"&gt;specified CSS element reference
identifiers</span>, which are used in certain CSS features to
override the normal <a href=#concept-id title=concept-id>ID</a>-based
mapping. <a href=#refsCSSIMAGES>[CSSIMAGES]</a></p>

<p>When a <code><a href=#document>Document</a></code> is created, it must be associated
with an initially-empty <dfn id=css-id-overrides-list>CSS ID overrides list</dfn>, which
consists of a list of mappings each of which consists of a string
name mapped to an <code><a href=#element>Element</a></code> node.</p>

<p>Each entry in the <a href=#css-id-overrides-list>CSS ID overrides list</a>, while it is
in the list, defines a <span>specified CSS element reference
identifier</span> mapping the given name to the given
<code><a href=#element>Element</a></code>. <a href=#refsCSSIMAGES>[CSSIMAGES]</a></p>

<p>On getting, the <code title=dom-document-cssElementMap><a href=#dom-document-csselementmap>cssElementMap</a></code> IDL
attribute must return a <code><a href=#domelementmap>DOMElementMap</a></code> object,
associated with the following algorithms, which expose the current
mappings:</p>

<dl><dt>The algorithm for getting the list of name-element mappings</dt>

<dd>

<p>Return the <code><a href=#document>Document</a></code>'s <a href=#css-id-overrides-list>CSS ID overrides
list</a>, maintaining the order in which the entries were
originally added to the list.</p>

</dd>

<dt>The algorithm for for mapping a name to a certain element</dt>

<dd>

<p>Let <var title="">name</var> be the name passed to the
algorithm and <var title="">element</var> be the
<code><a href=#element>Element</a></code> passed to the algorithm.</p>

<p>If <var title="">element</var> is null, run the algorithm for
deleting mappings by name, passing it <var title="">name</var>.</p>

<p>Otherwise, if there is an entry in the <code><a href=#document>Document</a></code>'s
<a href=#css-id-overrides-list>CSS ID overrides list</a> whose name is <var title="">name</var>, replace its current value with <var title="">element</var>.</p>

<p>Otherwise, add a mapping to the <code><a href=#document>Document</a></code>'s
<a href=#css-id-overrides-list>CSS ID overrides list</a> whose name is <var title="">name</var> and whose element is <var title="">element</var>.</p>

</dd>

<dt>The algorithm for deleting mappings by name</dt>

<dd>

<p>If there is an entry in the <code><a href=#document>Document</a></code>'s <a href=#css-id-overrides-list>CSS
ID overrides list</a> whose name is the name passed to this
algorithm, remove it. This also undefines the <span>specified CSS
element reference identifier</span> for that name. <a href=#refsCSSIMAGES>[CSSIMAGES]</a></p>

</dd>

</dl><p>The same object must be returned each time.</p>

</div>
<!--CSSREF-->

<div class=impl>

<hr><p>The <code><a href=#htmldocument>HTMLDocument</a></code> interface <span title="support
Expand Down Expand Up @@ -92191,6 +92322,11 @@ <h3 class="no-num">Reflecting IDL attributes</h3>
<dd><cite><a href=http://www.w3.org/TR/css3-fonts/>CSS Fonts
Module Level 3</a></cite>, J. Daggett. W3C.</dd>

<dt id=refsCSSIMAGES>[CSSIMAGES]</dt>
<dd><cite><a href=http://dev.w3.org/csswg/css3-images/>CSS Image
Values and Replaced Content Module Level 3</a></cite>, E. Etemad,
T. Atkins. W3C.</dd>

<dt id=refsCSSOM>[CSSOM]</dt>
<dd><cite><a href=http://dev.w3.org/csswg/cssom/>Cascading Style Sheets
Object Model (CSSOM)</a></cite>, A. van Kesteren. W3C.</dd>
Expand All @@ -92208,7 +92344,8 @@ <h3 class="no-num">Reflecting IDL attributes</h3>
Interface Module</a></cite>, T. &Ccedil;elik. W3C.</dd>

<dt id=refsCSSVALUES>[CSSVALUES]</dt>
<dd><cite><a href=http://dev.w3.org/csswg/css3-values/>CSS3 Values and Units</a></cite>, H. Lie, C. Lilley. W3C.</dd>
<dd><cite><a href=http://dev.w3.org/csswg/css3-values/>CSS3
Values and Units</a></cite>, H. Lie, C. Lilley. W3C.</dd>

<dt id=refsDOMCORE>[DOMCORE]</dt>
<dd><cite><a href=http://www.w3.org/TR/DOM-Level-3-Core/>Document
Expand Down

0 comments on commit 967f95a

Please sign in to comment.