Skip to content

Commit 3fc9245

Browse files
authored
[css-conditional-3][css-conditional-4] Create a css-conditional-4 draft, and dispose of the features in css-conditional-3 marked for moving to level 4. (#3777)
There were two commented-out features in css-conditional-3 marked as being deferred to level 4. These are removed from the draft, but NOT added in css-conditional-4, because: - the `@import` `supports()` syntax is already in https://drafts.csswg.org/css-cascade-4/#at-ruledef-import - the addition of an `@document` rule is probably no longer desirable given the discussion and removal in https://bugzilla.mozilla.org/show_bug.cgi?id=1035091 which was the only implementation. Also correct a few bits of metadata in css-conditional-3. This is being done as part of the resolution in #3207 (comment)
1 parent 550369f commit 3fc9245

File tree

2 files changed

+34
-218
lines changed

2 files changed

+34
-218
lines changed

css-conditional-3/Overview.bs

+2-218
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ Shortname: css-conditional
55
Level: 3
66
Status: ED
77
Work Status: Testing
8-
ED: https://drafts.csswg.org/css3-conditional/
8+
ED: https://drafts.csswg.org/css-conditional-3/
99
TR: https://www.w3.org/TR/css3-conditional/
1010
Previous Version: https://www.w3.org/TR/2013/CR-css3-conditional-20130404/
11-
Test Suite: http://test.csswg.org/suites/css3-conditional/nightly-unstable/
11+
Test Suite: http://test.csswg.org/suites/css-conditional-3_dev/nightly-unstable/
1212
Editor: L. David Baron, Mozilla https://www.mozilla.org/, https://dbaron.org/, w3cid 15393
1313
Abstract: This module contains the features of CSS for conditional processing of parts of
1414
style sheets, conditioned on capabilities of the processor or the
@@ -27,12 +27,6 @@ spec:css-color-4; type:property; text:color
2727
spec:html; type:element; text:link
2828
</pre>
2929

30-
<!--
31-
Things to go in level 4:
32-
33-
* Create some way to put these new conditional things on an @import.
34-
* The @document rule (commented out, down below). -->
35-
3630
<h2 id="introduction">Introduction</h2>
3731

3832
<h3 id="context">Background</h3>
@@ -478,216 +472,6 @@ compound values; implementations must implement all parts of the value
478472
in order to consider the declaration supported, either inside a style rule
479473
or in the declaration condition of an ''@supports'' rule.
480474

481-
<!--
482-
<h2 id="at-document">Document queries: the ''@document'' rule</h2>
483-
484-
The <dfn>@document</dfn> rule is a conditional group
485-
rule whose condition depends on the
486-
<a href="#url-of-doc">URL of the document being styled</a>.
487-
This allows style sheets, particularly user style sheets, to have styles
488-
that only apply to a set of pages rather than to all pages using the
489-
style sheet.
490-
491-
Issue: Given that this @-rule is intended primarily for user
492-
style sheets, what should this specification say about its use in author
493-
style sheets? Should it be forbidden? Should use instead be
494-
discouraged? Or should this specification remain neutral on the
495-
topic, since there are valid uses in author style sheets?
496-
497-
<p id="url-of-doc">The <dfn>URL of the document being styled</dfn> is
498-
the URI at which the document is located, excluding any fragment
499-
identifiers. (This means, for example, that HTTP redirects have been
500-
followed.) If the styles are being applied inside a complete document
501-
embedded into the presentation of another (e.g., [[HTML5]]&#39;s <code
502-
class="html">iframe</code>, <code class="html">object</code>, or <code
503-
class="html">img</code> elements), the relevant URI is that of the
504-
frame, not of its container. However, if content from other documents
505-
is mixed in via mechanisms that mix content from one document into
506-
another (e.g., [[SVG11]]&#39;s <code>use</code> element), then the
507-
address of the container document is used.
508-
509-
Note: In [[HTML5]], this is the
510-
<a href="http://dev.w3.org/html5/spec/dom.html#documents">document's address</a>
511-
of a document in a
512-
<a href="http://dev.w3.org/html5/spec/browsers.html#browsing-context">browsing context</a>.
513-
514-
<div class="issue">What form of normalization is done on URLs and domains
515-
before matching? In particular, this specification needs to describe:
516-
<ul>
517-
<li>what form is used for the <a href="#url-of-doc">URL of the document
518-
being styled</a> (and what has been normalized in that form)
519-
<li>what normalization (if any) happens to the argument of each of the match
520-
functions before the comparison that they describe and
521-
<li>whether the
522-
comparison algorithm used is string comparison or some other URL
523-
comparison algorithm.</ul></div>
524-
525-
The ''@document'' rule's condition is written as a
526-
comma-separated list of <dfn>URL matching functions</dfn>, and the
527-
condition evaluates to true whenever any one of those functions
528-
evaluates to true. The following URL matching functions are
529-
permitted:
530-
531-
<dl>
532-
<dt><dfn id="url-exact" title="url()|URL matching functions::exact">&lt;url&gt;</dfn>
533-
534-
<dd>
535-
The 'url()' function is the <dfn>exact url matching
536-
function</dfn>. It evaluates to true whenever the <a
537-
href="#url-of-doc">URL of the document being styled</a> is exactly
538-
the URL given.
539-
540-
Note: The 'url()' function, since it is a core syntax
541-
element in CSS, is allowed (subject to different character
542-
limitations and thus escaping requirements) to contain an unquoted
543-
value (in addition to the string values that are allowed as
544-
arguments for all four functions).
545-
546-
<div class="example">
547-
For example, this rule:
548-
<pre>
549-
@document url("http://www.w3.org/Style/CSS/") {
550-
#summary { background: yellow; color: black}
551-
}
552-
</pre>
553-
styles the <code class="html">summary</code> element on the page
554-
<code>http://www.w3.org/Style/CSS/</code>, but not on any other
555-
pages.
556-
</div>
557-
558-
559-
<dt><dfn id="url-prefix" title="url-prefix()|URL matching functions::prefix">url-prefix(&lt;string&gt;)</dfn>
560-
561-
<dd>
562-
The 'url-prefix()' function is the <dfn>url prefix
563-
matching function</dfn>. It evaluates to true whenever the
564-
<a href="#url-of-doc">URL of the document being styled</a>
565-
has the argument to the function as an
566-
initial substring (which is true when the two strings are equal).
567-
When the argument is the empty string, it evaluates to true for all
568-
documents.
569-
<div class="example">
570-
For example, this rule:
571-
<pre>
572-
@document url-prefix("http://www.w3.org/Style/CSS/") {
573-
#summary { background: yellow; color: black}
574-
}
575-
</pre>
576-
styles the <code class="html">summary</code> element on the page
577-
<code>http://www.w3.org/Style/CSS/</code> and on the page
578-
<code>http://www.w3.org/Style/CSS/Test</code>, but it does not
579-
affect the page <code>http://www.w3.org/</code> or the page
580-
<code>http://www.example.com/Style/CSS/</code>.
581-
</div>
582-
583-
584-
<dt><dfn id="url-domain" title="domain()|URL matching functions::domain">domain(&lt;string&gt;)</dfn>
585-
586-
<dd>
587-
The 'domain()' function is the <dfn>domain
588-
matching function</dfn>. It evaluates to true whenever
589-
the <a href="#url-of-doc">URL of the document being styled</a>
590-
has a host subcomponent (as defined in [[!URI]])
591-
and that host subcomponent is exactly the argument to the
592-
'domain()' function or a final substring of the host
593-
component is a period (U+002E) immediately followed by the argument
594-
to the 'domain()' function.
595-
<div class="example">
596-
For example, this rule:
597-
<pre>
598-
@document domain("w3.org") {
599-
body { font-size: 16px ! important }
600-
}
601-
</pre>
602-
changes the font size of the body element for pages such as
603-
<code>http://www.w3.org/Style/CSS/</code> and
604-
<code>http://w3.org/Style/CSS/</code> and
605-
<code>http://lists.w3.org/Archives/Public/www-style/</code>
606-
but it does not affect the page
607-
<code>http://www.example.com/Style/CSS/</code>.
608-
</div>
609-
610-
611-
<dt><dfn id="url-regexp" title="regexp()|URL matching functions::regular expression">regexp(&lt;string&gt;)</dfn>
612-
613-
<dd>
614-
The contents of the &lt;string&gt; argument <strong>must</strong>
615-
match the JavaScript <code>Pattern</code> production
616-
([[!ECMA-262-5.1]], section 15.10.1). However,
617-
failing to do so is not a CSS syntax error and does not trigger any
618-
error handling for CSS syntax errors.
619-
620-
The ''regexp()'' function evaluates to true whenever the string
621-
argument compiled as a JavaScript regular expression with the
622-
<code>global</code>, <code>ignoreCase</code> and
623-
<code>multiline</code> flags <em>disabled</em>
624-
(see [[!ECMA-262-5.1]], sections 15.10.7.2 through 15.10.7.4)
625-
compiles successfully and the resulting regular expression matches
626-
the entirety of the
627-
<a href="#url-of-doc">URL of the document being styled</a>.
628-
629-
Note: Note that regular expression must match the entire
630-
URL, not just a part of it.
631-
632-
Note: Note that this definition intentionally matches the
633-
behavior of the <a
634-
href="http://dev.w3.org/html5/spec/common-input-element-attributes.html#attr-input-pattern"><code class="html">pattern</code>
635-
attribute</a> on the <code class="html">input</code> element
636-
in [[HTML5]].
637-
638-
<div class="example">
639-
For example, this rule:
640-
<pre>
641-
@document regexp("https://www.w3.org/TR/\\d{4}/[^/]*-CSS2-\\d{8}/") {
642-
body { font-size: 20px ! important }
643-
}
644-
</pre>
645-
changes the font size of the body element for pages such as
646-
<code>https://www.w3.org/TR/2011/PR-CSS2-20110412/</code>.
647-
648-
Note: Note that the backslashes in the regular
649-
expression require CSS escaping as ''\\''.
650-
</div>
651-
652-
653-
</dl>
654-
655-
Implementations <strong>must</strong> treat any unknown URL matching
656-
functions as a syntax error, and thus ignore the ''@document'' rule.
657-
<span class="issue">Should we instead have more complicated error
658-
handling rules to make forward-compatibility work differently, or is
659-
this rule the best solution for such future expansion anyway?</span>
660-
661-
<div class="issue">This syntax doesn't offer any ability to do negations,
662-
which has been requested in <a
663-
href="https://bugzilla.mozilla.org/show_bug.cgi?id=349813">Mozilla bug
664-
349813</a>. Use cases that people have wanted negations for
665-
include:
666-
<ul>
667-
<li>User style sheets that want a particular rule in general, but know
668-
that that rule does more harm than good on specific sites.
669-
<li>Authors who have a rule that they want to apply to most of their
670-
pages, but wish to make a few exceptions for.
671-
</ul>
672-
</div>
673-
674-
This extends the lexical scanner in the
675-
<a href="https://www.w3.org/TR/CSS21/grammar.html">Grammar of CSS 2.1</a>
676-
([[!CSS21]], Appendix G) by adding:
677-
<pre>@{D}{O}{C}{U}{M}{E}{N}{T} {return DOCUMENT_SYM;}</pre>
678-
and the grammar by adding
679-
<pre>
680-
<dfn>document_rule</dfn>
681-
: DOCUMENT_SYM S+ <a>url_match_fn</a> ( "," S* <a>url_match_fn</a> )* <a>group_rule_body</a>
682-
;
683-
684-
<dfn>url_match_fn</dfn>
685-
: (URI | FUNCTION S* STRING S* ')' ) S*
686-
;
687-
</pre>
688-
-->
689-
690-
691475
<h2 id="apis">APIs</h2>
692476

693477
<h3 id='extentions-to-cssrule-interface'>

css-conditional-4/Overview.bs

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<pre class="metadata">
2+
Title: CSS Conditional Rules Module Level 4
3+
Group: csswg
4+
Shortname: css-conditional
5+
Level: 4
6+
Status: ED
7+
Work Status: Exploring
8+
ED: https://drafts.csswg.org/css-conditional-4/
9+
TR: https://www.w3.org/TR/css-conditional-4/
10+
Test Suite: http://test.csswg.org/suites/css-conditional-4_dev/nightly-unstable/
11+
Editor: L. David Baron, Mozilla https://www.mozilla.org/, https://dbaron.org/, w3cid 15393
12+
Abstract: This module contains the features of CSS for conditional processing of parts of
13+
style sheets, conditioned on capabilities of the processor or the
14+
document the style sheet is being applied to. It includes and extends the
15+
functionality of CSS level&nbsp;2 [[!CSS21]], which builds on CSS level&nbsp;1
16+
[[CSS1]]. The main extensions compared to level&nbsp;2 are allowing nesting of
17+
certain at-rules inside ''@media'', and the addition of the ''@supports'' rule for
18+
conditional processing.
19+
Default Highlight: css
20+
</pre>
21+
22+
<h2 id="introduction">Introduction</h2>
23+
24+
This is currently an early draft of the things that are <em>new</em> in level 4.
25+
The features in level 3 are still defined in [[css3-conditional]]
26+
and have not yet been copied here.
27+
28+
Issue: In the future, copy the contents of [[css3-conditional]] into this document.
29+
30+
31+
<h2 class=no-num id="acknowledgments">Acknowledgments</h2>
32+

0 commit comments

Comments
 (0)