Skip to content

Commit b7568a9

Browse files
committed
Fixed my handling of bad-url to mostly match webkit, so it's doable in the tokenizer. Appears to be web-friendly, even though it's incompatible with other browsers.
--HG-- extra : rebase_source : c1922a54d5ea8c8751fb550c3be048a5897c3e60
1 parent 449074d commit b7568a9

2 files changed

Lines changed: 92 additions & 34 deletions

File tree

css3-syntax/Overview.html

Lines changed: 52 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -250,14 +250,17 @@ <h2 class="no-num no-toc" id=contents> Table of contents</h2>
250250
<li><a href="#url-unquoted-state"><span class=secno>3.4.23. </span>
251251
URL-unquoted state</a>
252252

253-
<li><a href="#unicode-range-state"><span class=secno>3.4.24. </span>
253+
<li><a href="#bad-url-state"><span class=secno>3.4.24. </span> Bad-URL
254+
state</a>
255+
256+
<li><a href="#unicode-range-state"><span class=secno>3.4.25. </span>
254257
Unicode-range state</a>
255258

256-
<li><a href="#consume-an-escaped-character"><span class=secno>3.4.25.
259+
<li><a href="#consume-an-escaped-character"><span class=secno>3.4.26.
257260
</span> Consume an escaped character</a>
258261

259262
<li><a href="#set-the-unicode-range-tokens-range"><span
260-
class=secno>3.4.26. </span> Set the unicode-range token's range</a>
263+
class=secno>3.4.27. </span> Set the unicode-range token's range</a>
261264
</ul>
262265

263266
<li><a href="#tree-construction"><span class=secno>3.5. </span> Tree
@@ -1691,8 +1694,8 @@ <h4 id=url-double-quote-state><span class=secno>3.4.20. </span> <dfn
16911694

16921695
<dt><a href="#newline"><i>newline</i></a>
16931696

1694-
<dd> Emit a bad-url token. Switch to the <a href="#data-state0"><i>data
1695-
state</i></a>.
1697+
<dd> This is a <i>parse error</i>. Switch to the <a
1698+
href="#bad-url-state0"><i>bad-url state</i></a>.
16961699

16971700
<dt>U+005C REVERSE SOLIDUS (\)
16981701

@@ -1731,8 +1734,8 @@ <h4 id=url-single-quote-state><span class=secno>3.4.21. </span> <dfn
17311734

17321735
<dt><a href="#newline"><i>newline</i></a>
17331736

1734-
<dd> Emit a bad-url token. Switch to the <a href="#data-state0"><i>data
1735-
state</i></a>.
1737+
<dd> This is a <i>parse error</i>. Switch to the <a
1738+
href="#bad-url-state0"><i>bad-url state</i></a>.
17361739

17371740
<dt>U+005C REVERSE SOLIDUS (\)
17381741

@@ -1773,9 +1776,8 @@ <h4 id=url-end-state><span class=secno>3.4.22. </span> <dfn
17731776

17741777
<dt>anything else
17751778

1776-
<dd> This is a <i>parse error</i>. Emit a bad-url token. Switch to the <a
1777-
href="#data-state0"><i>data state</i></a>. Reconsume the <a
1778-
href="#current-input-character"><i>current input character</i></a>.
1779+
<dd> This is a <i>parse error</i>. Switch to the <a
1780+
href="#bad-url-state0"><i>bad-url state</i></a>.
17791781
</dl>
17801782

17811783
<h4 id=url-unquoted-state><span class=secno>3.4.23. </span> <dfn
@@ -1805,9 +1807,8 @@ <h4 id=url-unquoted-state><span class=secno>3.4.23. </span> <dfn
18051807

18061808
<dt><i>non-printing character</i>
18071809

1808-
<dd> This is a <i>parse error</i>. Emit a bad-url token. Switch to the <a
1809-
href="#data-state0"><i>data state</i></a>. Reconsume the <a
1810-
href="#current-input-character"><i>current input character</i></a>.
1810+
<dd> This is a <i>parse error</i>. Switch to the <a
1811+
href="#bad-url-state0"><i>bad-url state</i></a>.
18111812

18121813
<dt>U+005C REVERSE SOLIDUS
18131814

@@ -1825,7 +1826,34 @@ <h4 id=url-unquoted-state><span class=secno>3.4.23. </span> <dfn
18251826
character</i></a> to the url token's value. Remain in this state.
18261827
</dl>
18271828

1828-
<h4 id=unicode-range-state><span class=secno>3.4.24. </span> <dfn
1829+
<h4 id=bad-url-state><span class=secno>3.4.24. </span> <dfn
1830+
id=bad-url-state0>Bad-URL state</dfn></h4>
1831+
1832+
<p> Consume the <a href="#next-input-character"><i>next input
1833+
character</i></a>.
1834+
1835+
<dl>
1836+
<dt>U+0029 RIGHT PARENTHESIS ())
1837+
1838+
<dd> Emit a bad-url token. Switch to the <a href="#data-state0"><i>data
1839+
state</i></a>.
1840+
1841+
<dt>
1842+
1843+
<dt>U+005C REVERSE SOLIDUS
1844+
1845+
<dd> If the <a href="#next-input-character"><i>next input
1846+
character</i></a> is a <a href="#newline"><i>newline</i></a> or EOF, do
1847+
nothing and remain in this state.
1848+
<p> Otherwise, <a href="#consume-an-escaped-character0"><i>consume an
1849+
escaped character</i></a>. Remain in this state.
1850+
1851+
<dt>anything else
1852+
1853+
<dd> Do nothing. Remain in this state.
1854+
</dl>
1855+
1856+
<h4 id=unicode-range-state><span class=secno>3.4.25. </span> <dfn
18291857
id=unicode-range-state0>Unicode-range state</dfn></h4>
18301858

18311859
<p> Create a new unicode-range token with an empty range.
@@ -1878,7 +1906,7 @@ <h4 id=unicode-range-state><span class=secno>3.4.24. </span> <dfn
18781906
href="#current-input-character"><i>current input character</i></a>.
18791907
</dl>
18801908

1881-
<h4 id=consume-an-escaped-character><span class=secno>3.4.25. </span> <dfn
1909+
<h4 id=consume-an-escaped-character><span class=secno>3.4.26. </span> <dfn
18821910
id=consume-an-escaped-character0>Consume an escaped character</dfn></h4>
18831911

18841912
<p> This section describes how to <a
@@ -1911,7 +1939,7 @@ <h4 id=consume-an-escaped-character><span class=secno>3.4.25. </span> <dfn
19111939
character</i></a>.
19121940
</dl>
19131941

1914-
<h4 id=set-the-unicode-range-tokens-range><span class=secno>3.4.26. </span>
1942+
<h4 id=set-the-unicode-range-tokens-range><span class=secno>3.4.27. </span>
19151943
<dfn id=set-the-unicode-range-tokens-range0>Set the unicode-range token's
19161944
range</dfn></h4>
19171945

@@ -2050,8 +2078,6 @@ <h4 id=top-level-mode-><span class=secno>3.5.3. </span> <dfn
20502078

20512079
<dt>bad-string token
20522080

2053-
<dt>bad-url token
2054-
20552081
<dt>semicolon token
20562082

20572083
<dd> This is a <i>parse error</i>. Switch to the <a
@@ -2864,14 +2890,17 @@ <h2 class=no-num id=index> Index</h2>
28642890
<li>authoring tool, <a href="#authoring-tool"
28652891
title="authoring tool"><strong>4.2.</strong></a>
28662892

2893+
<li>Bad-URL state, <a href="#bad-url-state0"
2894+
title="Bad-URL state"><strong>3.4.24.</strong></a>
2895+
28672896
<li>Comment state, <a href="#comment-state0"
28682897
title="Comment state"><strong>3.4.8.</strong></a>
28692898

28702899
<li>Consume a block, <a href="#consume-a-block0"
28712900
title="Consume a block"><strong>3.5.13.</strong></a>
28722901

28732902
<li>Consume an escaped character, <a href="#consume-an-escaped-character0"
2874-
title="Consume an escaped character"><strong>3.4.25.</strong></a>
2903+
title="Consume an escaped character"><strong>3.4.26.</strong></a>
28752904

28762905
<li>current block, <a href="#current-block"
28772906
title="current block"><strong>3.5.13.</strong></a>
@@ -2906,7 +2935,7 @@ <h2 class=no-num id=index> Index</h2>
29062935
title="ending token"><strong>3.5.13.</strong></a>
29072936

29082937
<li>end of the range, <a href="#end-of-the-range"
2909-
title="end of the range"><strong>3.4.26.</strong></a>
2938+
title="end of the range"><strong>3.4.27.</strong></a>
29102939

29112940
<li>error flag, <a href="#error-flag"
29122941
title="error flag"><strong>3.5.13.</strong></a>
@@ -2983,7 +3012,7 @@ <h2 class=no-num id=index> Index</h2>
29833012

29843013
<li>Set the unicode-range token's range, <a
29853014
href="#set-the-unicode-range-tokens-range0"
2986-
title="Set the unicode-range token's range"><strong>3.4.26.</strong></a>
3015+
title="Set the unicode-range token's range"><strong>3.4.27.</strong></a>
29873016

29883017
<li>Single-quote-string state, <a href="#single-quote-string-state0"
29893018
title="Single-quote-string state"><strong>3.4.5.</strong></a>
@@ -2992,7 +3021,7 @@ <h2 class=no-num id=index> Index</h2>
29923021
title="stack of open rules"><strong>3.5.2.</strong></a>
29933022

29943023
<li>start of the range, <a href="#start-of-the-range"
2995-
title="start of the range"><strong>3.4.26.</strong></a>
3024+
title="start of the range"><strong>3.4.27.</strong></a>
29963025

29973026
<li>Style-rule mode, <a href="#style-rule-mode0"
29983027
title="Style-rule mode"><strong>3.5.6.</strong></a>
@@ -3023,7 +3052,7 @@ <h2 class=no-num id=index> Index</h2>
30233052
title="Transform-function-whitespace state"><strong>3.4.13.</strong></a>
30243053

30253054
<li>Unicode-range state, <a href="#unicode-range-state0"
3026-
title="Unicode-range state"><strong>3.4.24.</strong></a>
3055+
title="Unicode-range state"><strong>3.4.25.</strong></a>
30273056

30283057
<li>uppercase letter, <a href="#uppercase-letter"
30293058
title="uppercase letter"><strong>3.4.2.</strong></a>

css3-syntax/Overview.src.html

Lines changed: 40 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1651,8 +1651,8 @@ <h4>
16511651

16521652
<dt><i>newline</i>
16531653
<dd>
1654-
Emit a bad-url token.
1655-
Switch to the <i>data state</i>.
1654+
This is a <i>parse error</i>.
1655+
Switch to the <i>bad-url state</i>.
16561656

16571657
<dt>U+005C REVERSE SOLIDUS (\)
16581658
<dd>
@@ -1700,8 +1700,8 @@ <h4>
17001700

17011701
<dt><i>newline</i>
17021702
<dd>
1703-
Emit a bad-url token.
1704-
Switch to the <i>data state</i>.
1703+
This is a <i>parse error</i>.
1704+
Switch to the <i>bad-url state</i>.
17051705

17061706
<dt>U+005C REVERSE SOLIDUS (\)
17071707
<dd>
@@ -1750,9 +1750,7 @@ <h4>
17501750
<dt>anything else
17511751
<dd>
17521752
This is a <i>parse error</i>.
1753-
Emit a bad-url token.
1754-
Switch to the <i>data state</i>.
1755-
Reconsume the <i>current input character</i>.
1753+
Switch to the <i>bad-url state</i>.
17561754
</dl>
17571755

17581756
<h4>
@@ -1782,9 +1780,7 @@ <h4>
17821780
<dt><i>non-printing character</i>
17831781
<dd>
17841782
This is a <i>parse error</i>.
1785-
Emit a bad-url token.
1786-
Switch to the <i>data state</i>.
1787-
Reconsume the <i>current input character</i>.
1783+
Switch to the <i>bad-url state</i>.
17881784

17891785
<dt>U+005C REVERSE SOLIDUS
17901786
<dd>
@@ -1808,6 +1804,40 @@ <h4>
18081804
Remain in this state.
18091805
</dl>
18101806

1807+
1808+
<h4>
1809+
<dfn>Bad-URL state</dfn></h4>
1810+
1811+
<p>
1812+
Consume the <i>next input character</i>.
1813+
1814+
<dl>
1815+
<dt>U+0029 RIGHT PARENTHESIS ())
1816+
<dd>
1817+
Emit a bad-url token.
1818+
Switch to the <i>data state</i>.
1819+
1820+
<dt>
1821+
1822+
<dt>U+005C REVERSE SOLIDUS
1823+
<dd>
1824+
If the <i>next input character</i>
1825+
is a <i>newline</i> or EOF,
1826+
do nothing
1827+
and remain in this state.
1828+
1829+
<p>
1830+
Otherwise,
1831+
<i>consume an escaped character</i>.
1832+
Remain in this state.
1833+
1834+
<dt>anything else
1835+
<dd>
1836+
Do nothing.
1837+
Remain in this state.
1838+
</dl>
1839+
1840+
18111841
<h4>
18121842
<dfn>Unicode-range state</dfn></h4>
18131843

@@ -2043,7 +2073,6 @@ <h4>
20432073
<dt><span class='temp'>]</span> token
20442074
<dt><span class='temp'>)</span> token
20452075
<dt>bad-string token
2046-
<dt>bad-url token
20472076
<dt>semicolon token
20482077
<dd>
20492078
This is a <i>parse error</i>.

0 commit comments

Comments
 (0)