@@ -685,7 +685,8 @@ <h2 id=at-document><span class=secno>6. </span>Document queries: the
685685 < p class =issue > Given that this @-rule is intended primarily for user style
686686 sheets, what should this specification say about its use in author style
687687 sheets? Should it be forbidden? Should use instead be discouraged? Or
688- should this specification remain neutral on the topic?
688+ should this specification remain neutral on the topic, since there are
689+ valid uses in author style sheets?
689690
690691 < p > The ‘< code class =css > @document</ code > ’ rule's condition is
691692 written as a comma-separated list of < dfn id =url-matching-functions > URL
@@ -772,14 +773,42 @@ <h2 id=at-document><span class=secno>6. </span>Document queries: the
772773 < dt > regexp(<string>)
773774
774775 < dd >
775- < p class =issue > Write me</ p >
776+ < p > The contents of the <string> argument < strong > must</ strong >
777+ match the JavaScript < code > Pattern</ code > production. However, failing
778+ to do so is not a CSS syntax error and does not trigger any error
779+ handling for CSS syntax errors.</ p >
780+
781+ < p > The ‘< code class =css > regexp()</ code > ’ function evaluates
782+ to true whenever the string argument compiled as a JavaScript regular
783+ expression with the < code > global</ code > , < code > ignoreCase</ code > and
784+ < code > multiline</ code > flags < em > disabled</ em > (see < a href ="#ECMA-262 "
785+ rel =biblioentry > [ECMA-262]<!--{{!ECMA-262}}--> </ a > Edition 5, sections
786+ 15.10.7.2 through 15.10.7.4) compiles successfully and the resulting
787+ regular expression matches the entirety of the URL of the page.</ p >
788+
789+ < p class =note > Note that regular expression must match the entire URL, not
790+ just a part of it.</ p >
776791
777792 < p class =note > This definition intentionally matches the behavior of the
778793 < a
779794 href ="http://dev.w3.org/html5/spec/common-input-element-attributes.html#attr-input-pattern "> < code
780795 class =html > pattern</ code > attribute</ a > on the < code
781796 class =html > input</ code > element in < a href ="#HTML5 "
782797 rel =biblioentry > [HTML5]<!--{{HTML5}}--> </ a > .</ p >
798+
799+ < div class =example >
800+ < p > For example, this rule:</ p >
801+
802+ < pre > @document regexp("http://www.w3.org/TR/\\d{4}/[^/]*-CSS2-\\d{8}/") {
803+ body { font-size: 20px ! important }
804+ }</ pre >
805+
806+ < p > changes the font size of the body element for pages such as
807+ < code > http://www.w3.org/TR/2011/PR-CSS2-20110412/</ code > .</ p >
808+
809+ < p class =note > Note that the backslashes in the regular expression
810+ require CSS escaping as ‘< code class =css > \\</ code > ’.</ p >
811+ </ div >
783812 </ dl >
784813
785814 < p class =issue > What form of normalization is done on URLs and domains
@@ -996,6 +1025,15 @@ <h3 class=no-num id=normative-references>Normative references</h3>
9961025 </ dd >
9971026 <!---->
9981027
1028+ < dt id =ECMA-262 > [ECMA-262]
1029+
1030+ < dd > < a
1031+ href ="http://www.ecma-international.org/publications/standards/Ecma-262.htm "> < cite > ECMAScript
1032+ Language Specification, Third Edition.</ cite > </ a > December 1999. URL: < a
1033+ href ="http://www.ecma-international.org/publications/standards/Ecma-262.htm "> http://www.ecma-international.org/publications/standards/Ecma-262.htm</ a >
1034+ </ dd >
1035+ <!---->
1036+
9991037 < dt id =MEDIAQ > [MEDIAQ]
10001038
10011039 < dd > Håkon Wium Lie; et al. < a
0 commit comments