- From: David Baron via cvs-syncmail <cvsmail@w3.org>
- Date: Mon, 06 Jun 2011 21:33:39 +0000
- To: public-css-commits@w3.org
Update of /sources/public/csswg/css3-conditional In directory hutz:/tmp/cvs-serv8921 Modified Files: Overview.html Overview.src.html Log Message: Define regexp(). Index: Overview.html =================================================================== RCS file: /sources/public/csswg/css3-conditional/Overview.html,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- Overview.html 6 Jun 2011 17:51:14 -0000 1.9 +++ Overview.html 6 Jun 2011 21:33:36 -0000 1.10 @@ -685,7 +685,8 @@ <p class=issue>Given that this @-rule is intended primarily for user style sheets, what should this specification say about its use in author style sheets? Should it be forbidden? Should use instead be discouraged? Or - should this specification remain neutral on the topic? + should this specification remain neutral on the topic, since there are + valid uses in author style sheets? <p>The ‘<code class=css>@document</code>’ rule's condition is written as a comma-separated list of <dfn id=url-matching-functions>URL @@ -772,7 +773,21 @@ <dt>regexp(<string>) <dd> - <p class=issue>Write me</p> + <p>The contents of the <string> argument <strong>must</strong> + match the JavaScript <code>Pattern</code> production. However, failing + to do so is not a CSS syntax error and does not trigger any error + handling for CSS syntax errors.</p> + + <p>The ‘<code class=css>regexp()</code>’ function evaluates + to true whenever the string argument compiled as a JavaScript regular + expression with the <code>global</code>, <code>ignoreCase</code> and + <code>multiline</code> flags <em>disabled</em> (see <a href="#ECMA-262" + rel=biblioentry>[ECMA-262]<!--{{!ECMA-262}}--></a> Edition 5, sections + 15.10.7.2 through 15.10.7.4) compiles successfully and the resulting + regular expression matches the entirety of the URL of the page.</p> + + <p class=note>Note that regular expression must match the entire URL, not + just a part of it.</p> <p class=note>This definition intentionally matches the behavior of the <a @@ -780,6 +795,20 @@ class=html>pattern</code> attribute</a> on the <code class=html>input</code> element in <a href="#HTML5" rel=biblioentry>[HTML5]<!--{{HTML5}}--></a>.</p> + + <div class=example> + <p>For example, this rule:</p> + + <pre>@document regexp("http://www.w3.org/TR/\\d{4}/[^/]*-CSS2-\\d{8}/") { + body { font-size: 20px ! important } +}</pre> + + <p>changes the font size of the body element for pages such as + <code>http://www.w3.org/TR/2011/PR-CSS2-20110412/</code>.</p> + + <p class=note>Note that the backslashes in the regular expression + require CSS escaping as ‘<code class=css>\\</code>’.</p> + </div> </dl> <p class=issue>What form of normalization is done on URLs and domains @@ -996,6 +1025,15 @@ </dd> <!----> + <dt id=ECMA-262>[ECMA-262] + + <dd><a + href="http://www.ecma-international.org/publications/standards/Ecma-262.htm"><cite>ECMAScript + Language Specification, Third Edition.</cite></a> December 1999. URL: <a + href="http://www.ecma-international.org/publications/standards/Ecma-262.htm">http://www.ecma-international.org/publications/standards/Ecma-262.htm</a> + </dd> + <!----> + <dt id=MEDIAQ>[MEDIAQ] <dd>Håkon Wium Lie; et al. <a Index: Overview.src.html =================================================================== RCS file: /sources/public/csswg/css3-conditional/Overview.src.html,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- Overview.src.html 6 Jun 2011 17:51:14 -0000 1.9 +++ Overview.src.html 6 Jun 2011 21:33:36 -0000 1.10 @@ -495,7 +495,7 @@ style sheets, what should this specification say about its use in author style sheets? Should it be forbidden? Should use instead be discouraged? Or should this specification remain neutral on the -topic?</p> +topic, since there are valid uses in author style sheets?</p> <p>The '@document' rule's condition is written as a comma-separated list of <dfn>URL matching functions</dfn>, and the @@ -577,13 +577,38 @@ <dt>regexp(<string>)</dt> <dd> - <p class="issue">Write me</p> + <p>The contents of the <string> argument <strong>must</strong> + match the JavaScript <code>Pattern</code> production. However, + failing to do so is not a CSS syntax error and does not trigger any + error handling for CSS syntax errors.</p> + + <p>The ''regexp()'' function evaluates to true whenever the string + argument compiled as a JavaScript regular expression with the + <code>global</code>, <code>ignoreCase</code> and + <code>multiline</code> flags <em>disabled</em> + (see [[!ECMA-262]] Edition 5, sections 15.10.7.2 through 15.10.7.4) + compiles successfully and the resulting regular expression matches + the entirety of the URL of the page.</p> + + <p class="note">Note that regular expression must match the entire + URL, not just a part of it.</p> <p class="note">This definition intentionally matches the behavior of the <a href="http://dev.w3.org/html5/spec/common-input-element-attributes.html#attr-input-pattern"><code class="html">pattern</code> attribute</a> on the <code class="html">input</code> element in [[HTML5]].</p> + + <div class="example"> + <p>For example, this rule:</p> +<pre>@document regexp("http://www.w3.org/TR/\\d{4}/[^/]*-CSS2-\\d{8}/") { + body { font-size: 20px ! important } +}</pre> + <p>changes the font size of the body element for pages such as + <code>http://www.w3.org/TR/2011/PR-CSS2-20110412/</code>.</p> + <p class="note">Note that the backslashes in the regular + expression require CSS escaping as ''\\''.</p> + </div> </dd> </dl>
Received on Monday, 6 June 2011 21:33:40 UTC