Skip to content

Commit 4cd1229

Browse files
committed
Define the URL of the document being styled.
1 parent 5a86442 commit 4cd1229

2 files changed

Lines changed: 91 additions & 41 deletions

File tree

css3-conditional/Overview.html

Lines changed: 58 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -765,17 +765,41 @@ <h2 id=at-document><span class=secno>7. </span>Document queries: the
765765
&lsquo;<code class=css>@document</code>&rsquo; rule</h2>
766766

767767
<p>The <dfn id=document-rule>&lsquo;<code class=css>@document</code>&rsquo;
768-
rule</dfn> is a conditional group rule whose condition depends on the URL
769-
of the document being styled. This allows style sheets, particularly user
770-
style sheets, to have styles that only apply to a set of pages rather than
771-
to all pages using the style sheet.
768+
rule</dfn> is a conditional group rule whose condition depends on the <a
769+
href="#url-of-doc">URL of the document being styled</a>. This allows style
770+
sheets, particularly user style sheets, to have styles that only apply to
771+
a set of pages rather than to all pages using the style sheet.
772772

773773
<p class=issue>Given that this @-rule is intended primarily for user style
774774
sheets, what should this specification say about its use in author style
775775
sheets? Should it be forbidden? Should use instead be discouraged? Or
776776
should this specification remain neutral on the topic, since there are
777777
valid uses in author style sheets?
778778

779+
<p id=url-of-doc>The <dfn id=url-of-the-document-being-styled>URL of the
780+
document being styled</dfn> is the URI at which the document is located,
781+
excluding any fragment identifiers. (This means, for example, that HTTP
782+
redirects have been followed.) If the styles are being applied inside a
783+
complete document embedded into the presentation of another (e.g., <a
784+
href="#HTML5" rel=biblioentry>[HTML5]<!--{{HTML5}}--></a>&apos;s <code
785+
class=html>iframe</code>, <code class=html>object</code>, or <code
786+
class=html>img</code> elements), the relevant URI is that of the frame,
787+
not of its container. However, if content from other documents is mixed in
788+
via mechanisms that mix content from one document into another (e.g., <a
789+
href="#SVG11" rel=biblioentry>[SVG11]<!--{{SVG11}}--></a>&apos;s
790+
<code>use</code> element), then the address of the container document is
791+
used.
792+
793+
<p class=note>Note: In <a href="#HTML5"
794+
rel=biblioentry>[HTML5]<!--{{HTML5}}--></a>, this is the <a
795+
href="http://dev.w3.org/html5/spec/dom.html#the-document-s-address">document's
796+
address</a> of a document in a <a
797+
href="http://dev.w3.org/html5/spec/browsers.html#browsing-context">browsing
798+
context</a>.
799+
800+
<p class=issue>What form of normalization is done on URLs and domains
801+
before matching?
802+
779803
<p>The &lsquo;<code class=css>@document</code>&rsquo; rule's condition is
780804
written as a comma-separated list of <dfn id=url-matching-functions>URL
781805
matching functions</dfn>, and the condition evaluates to true whenever any
@@ -790,8 +814,8 @@ <h2 id=at-document><span class=secno>7. </span>Document queries: the
790814
<p>The &lsquo;<a href="#url-exact"><code
791815
class=css>url()</code></a>&rsquo; function is the <dfn
792816
id=exact-url-matching-function>exact url matching function</dfn>. It
793-
evaluates to true whenever the URL of the document being styled is
794-
exactly the URL given.</p>
817+
evaluates to true whenever the <a href="#url-of-doc">URL of the document
818+
being styled</a> is exactly the URL given.</p>
795819

796820
<p class=Note>The &lsquo;<a href="#url-exact"><code
797821
class=css>url()</code></a>&rsquo; function, since it is a core syntax
@@ -818,10 +842,10 @@ <h2 id=at-document><span class=secno>7. </span>Document queries: the
818842
<p>The &lsquo;<a href="#url-prefix"><code
819843
class=css>url-prefix()</code></a>&rsquo; function is the <dfn
820844
id=url-prefix-matching-function>url prefix matching function</dfn>. It
821-
evaluates to true whenever the URL of the document being styled has the
822-
argument to the function as an initial substring (which is true when the
823-
two strings are equal). When the argument is the empty string, it
824-
evaluates to true for all documents.</p>
845+
evaluates to true whenever the <a href="#url-of-doc">URL of the document
846+
being styled</a> has the argument to the function as an initial
847+
substring (which is true when the two strings are equal). When the
848+
argument is the empty string, it evaluates to true for all documents.</p>
825849

826850
<div class=example>
827851
<p>For example, this rule:</p>
@@ -844,13 +868,14 @@ <h2 id=at-document><span class=secno>7. </span>Document queries: the
844868
<p>The &lsquo;<a href="#url-domain"><code
845869
class=css>domain()</code></a>&rsquo; function is the <dfn
846870
id=domain-matching-function>domain matching function</dfn>. It evaluates
847-
to true whenever the URL of the page has a host subcomponent (as defined
848-
in <a href="#URI" rel=biblioentry>[URI]<!--{{!URI}}--></a>) and that
849-
host subcomponent is exactly the argument to the &lsquo;<a
850-
href="#url-domain"><code class=css>domain()</code></a>&rsquo; function
851-
or a final substring of the host component is a period (U+002E)
852-
immediately followed by the argument to the &lsquo;<a
853-
href="#url-domain"><code class=css>domain()</code></a>&rsquo; function.</p>
871+
to true whenever the <a href="#url-of-doc">URL of the document being
872+
styled</a> has a host subcomponent (as defined in <a href="#URI"
873+
rel=biblioentry>[URI]<!--{{!URI}}--></a>) and that host subcomponent is
874+
exactly the argument to the &lsquo;<a href="#url-domain"><code
875+
class=css>domain()</code></a>&rsquo; function or a final substring of
876+
the host component is a period (U+002E) immediately followed by the
877+
argument to the &lsquo;<a href="#url-domain"><code
878+
class=css>domain()</code></a>&rsquo; function.</p>
854879

855880
<div class=example>
856881
<p>For example, this rule:</p>
@@ -883,7 +908,8 @@ <h2 id=at-document><span class=secno>7. </span>Document queries: the
883908
rel=biblioentry>[ECMA-262]<!--{{!ECMA-262}}--></a> Edition 5, sections
884909
15.10.7.2 through 15.10.7.4 <span class=issue>fix reference and cite 5.1
885910
when final</span>) compiles successfully and the resulting regular
886-
expression matches the entirety of the URL of the page.</p>
911+
expression matches the entirety of the <a href="#url-of-doc">URL of the
912+
document being styled</a>.</p>
887913

888914
<p class=note>Note that regular expression must match the entire URL, not
889915
just a part of it.</p>
@@ -910,14 +936,6 @@ <h2 id=at-document><span class=secno>7. </span>Document queries: the
910936
</div>
911937
</dl>
912938

913-
<p class=issue>What form of normalization is done on URLs and domains
914-
before matching?
915-
916-
<p class=issue>Need to define what URL we care about, perhaps in terms of
917-
browsing context. It should apply to the URL of an
918-
iframe/object/embed/img; it should probably not apply to the URL of an
919-
svg:use.
920-
921939
<p>Implementations <strong>must</strong> treat any unknown URL matching
922940
functions as a syntax error, and thus ignore the &lsquo;<code
923941
class=css>@document</code>&rsquo; rule. <span class=issue>Should we
@@ -1233,6 +1251,16 @@ <h3 class=no-num id=other-references>Other references</h3>
12331251
href="http://www.w3.org/TR/2011/WD-html5-20110525/">http://www.w3.org/TR/2011/WD-html5-20110525/</a>
12341252
</dd>
12351253
<!---->
1254+
1255+
<dt id=SVG11>[SVG11]
1256+
1257+
<dd>Erik Dahlstr&#246;m; et al. <a
1258+
href="http://www.w3.org/TR/2011/WD-SVG11-20110512/"><cite>Scalable Vector
1259+
Graphics (SVG) 1.1 (Second Edition).</cite></a> 12 May 2011. W3C Working
1260+
Draft. (Work in progress.) URL: <a
1261+
href="http://www.w3.org/TR/2011/WD-SVG11-20110512/">http://www.w3.org/TR/2011/WD-SVG11-20110512/</a>
1262+
</dd>
1263+
<!---->
12361264
</dl>
12371265
<!--end-informative-->
12381266

@@ -1300,6 +1328,10 @@ <h2 class=no-num id=index>Index</h2>
13001328
functions, regular expression"><strong>7.</strong></a>
13011329
</ul>
13021330

1331+
<li>URL of the document being styled, <a
1332+
href="#url-of-the-document-being-styled" title="URL of the document being
1333+
styled"><strong>7.</strong></a>
1334+
13031335
<li>url-prefix(), <a href="#url-prefix"
13041336
title="url-prefix()"><strong>7.</strong></a>
13051337

css3-conditional/Overview.src.html

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,8 @@ <h3 id="partial-implementations">Partial implementations</h3>
554554
<h2 id="at-document">Document queries: the '@document' rule</h2>
555555

556556
<p>The <dfn>'@document' rule</dfn> is a conditional group
557-
rule whose condition depends on the URL of the document being styled.
557+
rule whose condition depends on the
558+
<a href="#url-of-doc">URL of the document being styled</a>.
558559
This allows style sheets, particularly user style sheets, to have styles
559560
that only apply to a set of pages rather than to all pages using the
560561
style sheet.</p>
@@ -565,6 +566,27 @@ <h2 id="at-document">Document queries: the '@document' rule</h2>
565566
discouraged? Or should this specification remain neutral on the
566567
topic, since there are valid uses in author style sheets?</p>
567568

569+
<p id="url-of-doc">The <dfn>URL of the document being styled</dfn> is
570+
the URI at which the document is located, excluding any fragment
571+
identifiers. (This means, for example, that HTTP redirects have been
572+
followed.) If the styles are being applied inside a complete document
573+
embedded into the presentation of another (e.g., [[HTML5]]&apos;s <code
574+
class="html">iframe</code>, <code class="html">object</code>, or <code
575+
class="html">img</code> elements), the relevant URI is that of the
576+
frame, not of its container. However, if content from other documents
577+
is mixed in via mechanisms that mix content from one document into
578+
another (e.g., [[SVG11]]&apos;s <code>use</code> element), then the
579+
address of the container document is used.</p>
580+
581+
<p class="note">Note: In [[HTML5]], this is the
582+
<a href="http://dev.w3.org/html5/spec/dom.html#the-document-s-address">document's address</a>
583+
of a document in a
584+
<a href="http://dev.w3.org/html5/spec/browsers.html#browsing-context">browsing context</a>.</p>
585+
586+
<p class="issue">What form of normalization is done on URLs and domains
587+
before matching?</p>
588+
589+
568590
<p>The '@document' rule's condition is written as a
569591
comma-separated list of <dfn>URL matching functions</dfn>, and the
570592
condition evaluates to true whenever any one of those functions
@@ -576,8 +598,9 @@ <h2 id="at-document">Document queries: the '@document' rule</h2>
576598

577599
<dd>
578600
<p>The 'url()' function is the <dfn>exact url matching
579-
function</dfn>. It evaluates to true whenever the URL of the
580-
document being styled is exactly the URL given.</p>
601+
function</dfn>. It evaluates to true whenever the <a
602+
href="#url-of-doc">URL of the document being styled</a> is exactly
603+
the URL given.</p>
581604

582605
<p class="Note">The 'url()' function, since it is a core syntax
583606
element in CSS, is allowed (subject to different character
@@ -600,8 +623,9 @@ <h2 id="at-document">Document queries: the '@document' rule</h2>
600623

601624
<dd>
602625
<p>The 'url-prefix()' function is the <dfn>url prefix
603-
matching function</dfn>. It evaluates to true whenever the URL of
604-
the document being styled has the argument to the function as an
626+
matching function</dfn>. It evaluates to true whenever the
627+
<a href="#url-of-doc">URL of the document being styled</a>
628+
has the argument to the function as an
605629
initial substring (which is true when the two strings are equal).
606630
When the argument is the empty string, it evaluates to true for all
607631
documents.</p>
@@ -623,7 +647,8 @@ <h2 id="at-document">Document queries: the '@document' rule</h2>
623647
<dd>
624648
<p>The 'domain()' function is the <dfn>domain
625649
matching function</dfn>. It evaluates to true whenever
626-
the URL of the page has a host subcomponent (as defined in [[!URI]])
650+
the <a href="#url-of-doc">URL of the document being styled</a>
651+
has a host subcomponent (as defined in [[!URI]])
627652
and that host subcomponent is exactly the argument to the
628653
'domain()' function or a final substring of the host
629654
component is a period (U+002E) immediately followed by the argument
@@ -657,7 +682,8 @@ <h2 id="at-document">Document queries: the '@document' rule</h2>
657682
(see [[!ECMA-262]] Edition 5, sections 15.10.7.2 through 15.10.7.4
658683
<span class="issue">fix reference and cite 5.1 when final</span>)
659684
compiles successfully and the resulting regular expression matches
660-
the entirety of the URL of the page.</p>
685+
the entirety of the
686+
<a href="#url-of-doc">URL of the document being styled</a>.</p>
661687

662688
<p class="note">Note that regular expression must match the entire
663689
URL, not just a part of it.</p>
@@ -682,14 +708,6 @@ <h2 id="at-document">Document queries: the '@document' rule</h2>
682708

683709
</dl>
684710

685-
<p class="issue">What form of normalization is done on URLs and domains
686-
before matching?</p>
687-
688-
<p class="issue">Need to define what URL we care about, perhaps in terms
689-
of browsing context. It should apply to the URL of an
690-
iframe/object/embed/img; it should probably not apply to the URL of an
691-
svg:use.</p>
692-
693711
<p>Implementations <strong>must</strong> treat any unknown URL matching
694712
functions as a syntax error, and thus ignore the '@document'
695713
rule. <span class="issue">Should we instead have more complicated error

0 commit comments

Comments
 (0)