Skip to content

Commit 46b2803

Browse files
committed
Removed element-ref(), combining it into element(), because roc convinced me there's no real case to use more than an id selector.
Rejiggered the text in general, including changing the host language hook for element references. Also added <element-reference> into the <image> and <image-list> definition.
1 parent f7901d1 commit 46b2803

2 files changed

Lines changed: 61 additions & 113 deletions

File tree

css3-images/Overview.html

Lines changed: 51 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919

2020
<h1>CSS Image Values and Replaced Content Module Level 3</h1>
2121

22-
<h2 class="no-num no-toc" id=longstatus-date>Editor's Draft 1 December
22+
<h2 class="no-num no-toc" id=longstatus-date>Editor's Draft 2 December
2323
2010</h2>
2424

2525
<dl>
2626
<dt>This version:</dt>
27-
<!-- <dd><a href="http://www.w3.org/TR/2010/CR-css3-images-20101201/">http://www.w3.org/TR/2010/CR-css3-images-20101201/</a></dd> -->
27+
<!-- <dd><a href="http://www.w3.org/TR/2010/CR-css3-images-20101202/">http://www.w3.org/TR/2010/CR-css3-images-20101202/</a></dd> -->
2828

2929
<dd><a
3030
href="http://dev.w3.org/csswg/css3-images/">http://dev.w3.org/csswg/css3-images/</a>
@@ -132,7 +132,7 @@ <h2 class="no-num no-toc" id=contents>Table of contents</h2>
132132

133133
<li><a href="#element-reference"><span class=secno>4.3. </span>Using
134134
Elements as Images: The &lsquo;<code class=css>element()</code>&rsquo;
135-
and &lsquo;<code class=css>element-ref()</code>&rsquo; functions</a>
135+
notation</a>
136136
</ul>
137137

138138
<li><a href="#gradients"><span class=secno>5. </span>Gradients</a>
@@ -296,7 +296,7 @@ <h2 id=image><span class=secno>4. </span>Image Values: the &lt;image&gt;
296296
<p>The &lt;image&gt; value type denotes a 2D image. It is defined as
297297

298298
<pre
299-
class=prod><dfn id=ltimagegt>&lt;image&gt;</dfn> = &lt;url&gt; | &lt;image-list&gt; | &lt;gradient&gt;</pre>
299+
class=prod><dfn id=ltimagegt>&lt;image&gt;</dfn> = &lt;url> | &lt;image-list> | &lt;gradient> | &lt;element-reference></pre>
300300

301301
<p>Image values can be used in many CSS properties, including the
302302
&lsquo;<code class=property>background-image</code>&rsquo;, &lsquo;<code
@@ -352,7 +352,7 @@ <h3 id=image-notation><span class=secno>4.2. </span>Image Fallbacks: the
352352
syntax for &lsquo;<code class=css>image()</code>&rsquo; is defined as
353353

354354
<pre class=prod><dfn id=ltimage-listgt>&lt;image-list&gt;</dfn> = <!--
355-
-->image( [ &lt;image-decl&gt; , ]* [ &lt;image-decl&gt; | &lt;color> | &lt;gradient> ] )</pre>
355+
-->image( [ &lt;image-decl&gt; , ]* [ &lt;image-decl&gt; | &lt;color> | &lt;gradient> | &lt;element-reference> ] )</pre>
356356

357357
<p>where &lt;image-decl&gt; is given by
358358

@@ -418,93 +418,53 @@ <h3 id=image-notation><span class=secno>4.2. </span>Image Fallbacks: the
418418

419419
<div>
420420
<h3 id=element-reference><span class=secno>4.3. </span>Using Elements as
421-
Images: The &lsquo;<code class=css>element()</code>&rsquo; and
422-
&lsquo;<code class=css>element-ref()</code>&rsquo; functions</h3>
423-
424-
<p>The &lsquo;<code class=css>element()</code>&rsquo; and &lsquo;<code
425-
class=css>element-ref()</code>&rsquo; functions allow an author to
426-
specify an element in the document that should be used as an image. This
427-
is useful for many things; for example, in HTML one may use these
428-
functions to refer to a &lt;canvas> element to get a scriptable
429-
background for another element.</p>
430-
431-
<div>
432-
<h4 class=no-toc id=the-element-function><span class=secno>4.3.1.
433-
</span>The &lsquo;<code class=css>element()</code>&rsquo; function</h4>
434-
435-
<p>The &lsquo;<code class=css>element()</code>&rsquo; function allows
436-
the author to refer to an element in the document by its id and treat
437-
it as an image, to be used in properties like background-image. As the
438-
referenced element changes, for example, by the user typing into a
439-
&lt;textarea> element or a script drawing into a &lt;canvas> element in
440-
HTML, the image produced by the element() function stays in sync,
441-
allowing dynamic and interesting effects to be produced.</p>
442-
443-
<p>The &lsquo;<code class=css>element()</code>&rsquo; function takes a
444-
single argument, which must be an ID Selector. If no element in the
445-
document matches the selector, the function represents a fully
446-
transparent image with no intrinsic dimensions, equivalent to
447-
<code>image(transparent)</code>. Otherwise, the function represents an
448-
image with width and height equal to the width and height of the
449-
matched element, with an appearance exactly equivalent to that of the
450-
referenced element. Whether or not the referenced element is currently
451-
being rendered on-screen, for media types where this is relevant, must
452-
not affect the appearance of the image represented by the function; the
453-
image must always be equivalent to how the element would appear when
454-
rendered on-screen. If the document changes so that which element is
455-
matched, or whether an element is matched at all, changes, the image
456-
represented by the function must change accordingly.</p>
457-
458-
<p>If the argument passed to &lsquo;<code
459-
class=css>element()</code>&rsquo; isn't an id selector, but is a valid
460-
selector otherwise, the function represents a fully transparent image
461-
with no intrinsic dimensions. If the argument isn't a valid selector,
462-
it is a syntax error.</p>
463-
464-
<p class=issue>I'm currently defining this to only take an id selector,
465-
but I'd like for it to take arbitrary selectors, and represent the
466-
first matched element. This is necessary for the re-use of this
467-
function in other specifications like Positioned Layout. Should I just
468-
bite the bullet and make it a generic selector now?</p>
469-
470-
<div class=example> TODO: create reasonable example</div>
471-
</div>
421+
Images: The &lsquo;<code class=css>element()</code>&rsquo; notation</h3>
422+
423+
<p>The &lsquo;<code class=css>element()</code>&rsquo; function allows an
424+
author to reference an element in the document that should be used as an
425+
image. As the referenced element changes, for example, by the user
426+
typing into a &lt;textarea> element or a script drawing into a
427+
&lt;canvas> element in HTML, the image produced by the &lsquo;<code
428+
class=css>element()</code>&rsquo; function stays in sync, allowing
429+
dynamic effects such as script-animated background images or previews of
430+
the next slide in a slideshow. The syntax for &lsquo;<code
431+
class=css>element()</code>&rsquo; is defined as:</p>
472432

473-
<div>
474-
<h4 class=no-toc id=the-element-ref-function><span class=secno>4.3.2.
475-
</span>The &lsquo;<code class=css>element-ref()</code>&rsquo; function</h4>
476-
477-
<p>The &lsquo;<code class=css>element-ref()</code>&rsquo; function does
478-
essentially the same thing as the &lsquo;<code
479-
class=css>element()</code>&rsquo; function - it allows the author to
480-
use an element as an image. The difference is in how it references the
481-
element - rather than taking a selector, it just takes an identifier,
482-
which is mapped to some element by the host language.</p>
483-
484-
<p>The &lsquo;<code class=css>element-ref()</code>&rsquo; function takes
485-
a single argument, which must be an IDENT. The host language for the
486-
document may expose a method of giving elements a <dfn
487-
id=specified-element-ref-identifier>specified element-ref()
488-
identifier</dfn> associating the element with an identifier; CSS does
489-
not define how this occurs. The identifiers for this function exist in
490-
a unique namespace and must not overlap with other identifiers used
491-
elsewhere in CSS. If an element is associated with the identifier
492-
passed to the function, the function represents an image in an
493-
identical manner to the &lsquo;<code class=css>element()</code>&rsquo;
494-
function, with the element associated with the identifier in place of
495-
the element matched by the selector. If no element is associated with
496-
the identifier passed to the function, the function represents a fully
497-
transparent image with no intrinsic dimensions. If the element
498-
associated with the identifier, or whether an element is associated
499-
with the identifier at all, changes, the image represented by the
500-
function must change accordingly.</p>
501-
502-
<p>If the argument passed to &lsquo;<code
503-
class=css>element-ref()</code>&rsquo; isn't an IDENT, it is a syntax
504-
error.</p>
505-
506-
<div class=example> TODO: Create html example using canvas</div>
507-
</div>
433+
<pre
434+
class=prod><dfn id=ltelement-reference>&lt;element-reference></dfn> = element( [&lt;id-selector> | &lt;identifier> ] )</pre>
435+
436+
<p>where &lt;id-selector> is an ID selector [[SELECTORS3]], and
437+
&lt;identifier> is an identifer [[CSS3VALUES]].</p>
438+
439+
<p>If the argument to the &lsquo;<code class=css>element()</code>&rsquo;
440+
function is an ID selector, the function references the element matched
441+
by the selector. If it's an identifier, the function references the
442+
element who's <dfn id=css-element-reference-identifier>CSS element
443+
reference identifier</dfn> is the identifier. (CSS does not define how
444+
an element acquires a &lsquo;<a
445+
href="#css-element-reference-identifier"><code class=css>CSS element
446+
reference identifier</code></a>&rsquo;; that is determined by the host
447+
language.) If no element in the document matches the selector, or no
448+
element has the identifier as its &lsquo;<a
449+
href="#css-element-reference-identifier"><code class=css>CSS element
450+
reference identifier</code></a>&rsquo;, the function represents a fully
451+
transparent image with no intrinsic dimensions, equivalent to
452+
<code>image(transparent)</code>. Otherwise, the function represents an
453+
image with width and height equal to the width and height of the
454+
referenced element, with an appearance exactly equivalent to that of the
455+
referenced element. Whether or not the referenced element is currently
456+
being rendered on-screen, for media types where this is relevant, must
457+
not affect the appearance of the image represented by the function; the
458+
image must always be equivalent to how the element would appear when
459+
rendered on-screen. If the document changes so that which element is
460+
matched, or whether an element is matched at all, changes, the image
461+
represented by the function must change accordingly.</p>
462+
463+
<p>If the argument passed to &lsquo;<code
464+
class=css>element()</code>&rsquo; isn't an ID selector or an ident, it
465+
is a syntax error.</p>
466+
467+
<div class=example> TODO: copy an example from the MozHacks article</div>
508468
</div>
509469

510470
<div>

css3-images/Overview.src.html

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ <h2 id="image">Image Values: the &lt;image&gt; value type</h2>
133133

134134
<p>The &lt;image&gt; value type denotes a 2D image. It is defined as
135135

136-
<pre class="prod"><dfn>&lt;image&gt;</dfn> = &lt;url&gt; | &lt;image-list&gt; | &lt;gradient&gt;</pre>
136+
<pre class="prod"><dfn>&lt;image&gt;</dfn> = &lt;url> | &lt;image-list> | &lt;gradient> | &lt;element-reference></pre>
137137

138138
<p>Image values can be used in many CSS properties, including the
139139
'background-image', 'list-style-image', 'cursor' properties [[!CSS21]].
@@ -176,7 +176,7 @@ <h3 id="image-notation">Image Fallbacks: the ''image()'' notation</h3>
176176
that it can load and display. The syntax for ''image()'' is defined as
177177

178178
<pre class="prod"><dfn>&lt;image-list&gt;</dfn> = <!--
179-
-->image( [ &lt;image-decl&gt; , ]* [ &lt;image-decl&gt; | &lt;color> | &lt;gradient> ] )</pre>
179+
-->image( [ &lt;image-decl&gt; , ]* [ &lt;image-decl&gt; | &lt;color> | &lt;gradient> | &lt;element-reference> ] )</pre>
180180

181181
<p>where &lt;image-decl&gt; is given by
182182

@@ -229,26 +229,14 @@ <h3 id="image-notation">Image Fallbacks: the ''image()'' notation</h3>
229229
</div>
230230

231231
<div>
232-
<h3 id=element-reference>Using Elements as Images: The ''element()'' and ''element-ref()'' functions</h3>
233-
<p>The ''element()'' and ''element-ref()'' functions allow an author to specify an element in the document that should be used as an image. This is useful for many things; for example, in HTML one may use these functions to refer to a &lt;canvas> element to get a scriptable background for another element.</p>
234-
<div>
235-
<h4 class=no-toc>The ''element()'' function</h4>
236-
<p>The ''element()'' function allows the author to refer to an element in the document by its id and treat it as an image, to be used in properties like background-image. As the referenced element changes, for example, by the user typing into a &lt;textarea> element or a script drawing into a &lt;canvas> element in HTML, the image produced by the element() function stays in sync, allowing dynamic and interesting effects to be produced.</p>
237-
<p>The ''element()'' function takes a single argument, which must be an ID Selector. If no element in the document matches the selector, the function represents a fully transparent image with no intrinsic dimensions, equivalent to <code>image(transparent)</code>. Otherwise, the function represents an image with width and height equal to the width and height of the matched element, with an appearance exactly equivalent to that of the referenced element. Whether or not the referenced element is currently being rendered on-screen, for media types where this is relevant, must not affect the appearance of the image represented by the function; the image must always be equivalent to how the element would appear when rendered on-screen. If the document changes so that which element is matched, or whether an element is matched at all, changes, the image represented by the function must change accordingly.</p>
238-
<p>If the argument passed to ''element()'' isn't an id selector, but is a valid selector otherwise, the function represents a fully transparent image with no intrinsic dimensions. If the argument isn't a valid selector, it is a syntax error.</p>
239-
<p class=issue>I'm currently defining this to only take an id selector, but I'd like for it to take arbitrary selectors, and represent the first matched element. This is necessary for the re-use of this function in other specifications like Positioned Layout. Should I just bite the bullet and make it a generic selector now?</p>
240-
<div class=example>
241-
TODO: create reasonable example
242-
</div>
243-
</div>
244-
<div>
245-
<h4 class=no-toc>The ''element-ref()'' function</h4>
246-
<p>The ''element-ref()'' function does essentially the same thing as the ''element()'' function - it allows the author to use an element as an image. The difference is in how it references the element - rather than taking a selector, it just takes an identifier, which is mapped to some element by the host language.</p>
247-
<p>The ''element-ref()'' function takes a single argument, which must be an IDENT. The host language for the document may expose a method of giving elements a <dfn>specified element-ref() identifier</dfn> associating the element with an identifier; CSS does not define how this occurs. The identifiers for this function exist in a unique namespace and must not overlap with other identifiers used elsewhere in CSS. If an element is associated with the identifier passed to the function, the function represents an image in an identical manner to the ''element()'' function, with the element associated with the identifier in place of the element matched by the selector. If no element is associated with the identifier passed to the function, the function represents a fully transparent image with no intrinsic dimensions. If the element associated with the identifier, or whether an element is associated with the identifier at all, changes, the image represented by the function must change accordingly.</p>
248-
<p>If the argument passed to ''element-ref()'' isn't an IDENT, it is a syntax error.</p>
249-
<div class=example>
250-
TODO: Create html example using canvas
251-
</div>
232+
<h3 id=element-reference>Using Elements as Images: The ''element()'' notation</h3>
233+
<p>The ''element()'' function allows an author to reference an element in the document that should be used as an image. As the referenced element changes, for example, by the user typing into a &lt;textarea> element or a script drawing into a &lt;canvas> element in HTML, the image produced by the ''element()'' function stays in sync, allowing dynamic effects such as script-animated background images or previews of the next slide in a slideshow. The syntax for ''element()'' is defined as:</p>
234+
<pre class=prod><dfn>&lt;element-reference></dfn> = element( [&lt;id-selector> | &lt;identifier> ] )</pre>
235+
<p>where &lt;id-selector> is an ID selector [[SELECTORS3]], and &lt;identifier> is an identifer [[CSS3VALUES]].</p>
236+
<p>If the argument to the ''element()'' function is an ID selector, the function references the element matched by the selector. If it's an identifier, the function references the element who's <dfn>CSS element reference identifier</dfn> is the identifier. (CSS does not define how an element acquires a ''CSS element reference identifier''; that is determined by the host language.) If no element in the document matches the selector, or no element has the identifier as its ''CSS element reference identifier'', the function represents a fully transparent image with no intrinsic dimensions, equivalent to <code>image(transparent)</code>. Otherwise, the function represents an image with width and height equal to the width and height of the referenced element, with an appearance exactly equivalent to that of the referenced element. Whether or not the referenced element is currently being rendered on-screen, for media types where this is relevant, must not affect the appearance of the image represented by the function; the image must always be equivalent to how the element would appear when rendered on-screen. If the document changes so that which element is matched, or whether an element is matched at all, changes, the image represented by the function must change accordingly.</p>
237+
<p>If the argument passed to ''element()'' isn't an ID selector or an ident, it is a syntax error.</p>
238+
<div class=example>
239+
TODO: copy an example from the MozHacks article
252240
</div>
253241
</div>
254242

0 commit comments

Comments
 (0)