Skip to content

Commit

Permalink
[giowt] (2) Make the feed sniffer skip BOMs.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.whatwg.org/webapps@1282 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Feb 29, 2008
1 parent bc27356 commit ccebe52
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 17 deletions.
25 changes: 17 additions & 8 deletions index
Original file line number Diff line number Diff line change
Expand Up @@ -30488,7 +30488,14 @@ user reload must be equivalent to .reload()
<p>Initialise <var title="">pos</var> to 0.

<li>
<p>Examine <span><var title="">s</var>[<var title="">pos</var>]</span>.</p>
<p>If <span><var title="">s</var>[0]</span> is 0xEF, <span><var
title="">s</var>[1]</span> is 0xBB, and <span><var
title="">s</var>[2]</span> is 0xBF, then set <var title="">pos</var> to
3. (This skips over a leading UTF-8 BOM, if any.)

<li>
<p><i>Loop start:</i> Examine <span><var title="">s</var>[<var
title="">pos</var>]</span>.</p>

<dl
class=switch><!-- skip whitespace (S token as defined in XML 1.0 section 2.3; production [3] -->
Expand Down Expand Up @@ -30521,12 +30528,12 @@ user reload must be equivalent to .reload()
<span><var title="">pos</var>+2</span> in <var title="">s</var> are
exactly equal to 0x2D, 0x2D, 0x3E respectively (ASCII for "<code
title="">--&gt;</code>"), then increase <var title="">pos</var> by 3
and jump back to the previous step (step 5) in the overall algorithm in
this section.
and jump back to the previous step (the step labelled <i>loop
start</i>) in the overall algorithm in this section.

<li>Otherwise, increase <var title="">pos</var> by 1.

<li>Otherwise, return to step 2 in these substeps.
<li>Return to step 2 in these substeps.
</ol>

<li>
Expand All @@ -30535,16 +30542,17 @@ user reload must be equivalent to .reload()
<!-- this skips past a DOCTYPE if there is one. It is brain-dead
because we don't have to be clever to parse the Atom and RSS x.y
DOCTYPEs, as they don't do anything clever like have internal
subsets of quoted ">" characters. If this fails, then that's ok,
subsets or quoted ">" characters. If this fails, then that's ok,
we'll treat it as HTML which is fine since we know it's not a feed
in that case. -->

<ol>
<li>Increase <var title="">pos</var> by 1.

<li>If <span><var title="">s</var>[<var title="">pos</var>]</span> equal
0x3E, then increase <var title="">pos</var> by 1 and jump back to step
5 in the overall algorithm in this section.
0x3E, then increase <var title="">pos</var> by 1 and jump back to the
step labelled <i>loop start</i> in the overall algorithm in this
section.

<li>Otherwise, return to step 1 in these substeps.
</ol>
Expand All @@ -30559,7 +30567,8 @@ user reload must be equivalent to .reload()
<li>If <span><var title="">s</var>[<var title="">pos</var>]</span> and
<span><var title="">s</var>[<var title="">pos</var>+1]</span> equal
0x3F and 0x3E respectively, then increase <var title="">pos</var> by 1
and jump back to step 5 in the overall algorithm in this section.
and jump back to the step labelled <i>loop start</i> in the overall
algorithm in this section.

<li>Otherwise, return to step 1 in these substeps.
</ol>
Expand Down
25 changes: 16 additions & 9 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -28085,7 +28085,13 @@ user reload must be equivalent to .reload()

<li><p>Initialise <var title="">pos</var> to 0.</p></li>

<li><p>Examine <span><var title="">s</var>[<var
<li><p>If <span><var title="">s</var>[0]</span> is 0xEF, <span><var
title="">s</var>[1]</span> is 0xBB, and <span><var
title="">s</var>[2]</span> is 0xBF, then set <var
title="">pos</var> to 3. (This skips over a leading UTF-8 BOM, if
any.)</p></li>

<li><p><i>Loop start:</i> Examine <span><var title="">s</var>[<var
title="">pos</var>]</span>.</p>

<dl class="switch">
Expand Down Expand Up @@ -28119,12 +28125,12 @@ user reload must be equivalent to .reload()
title="">pos</var>+2</span> in <var title="">s</var> are exactly
equal to 0x2D, 0x2D, 0x3E respectively (ASCII for "<code
title="">--&gt;</code>"), then increase <var title="">pos</var>
by 3 and jump back to the previous step (step 5) in the overall
algorithm in this section.</li>
by 3 and jump back to the previous step (the step labelled
<i>loop start</i>) in the overall algorithm in this section.</li>

<li>Otherwise, increase <var title="">pos</var> by 1.</li>

<li>Otherwise, return to step 2 in these substeps.</li>
<li>Return to step 2 in these substeps.</li>

</ol>

Expand All @@ -28137,7 +28143,7 @@ user reload must be equivalent to .reload()
<!-- this skips past a DOCTYPE if there is one. It is brain-dead
because we don't have to be clever to parse the Atom and RSS x.y
DOCTYPEs, as they don't do anything clever like have internal
subsets of quoted ">" characters. If this fails, then that's ok,
subsets or quoted ">" characters. If this fails, then that's ok,
we'll treat it as HTML which is fine since we know it's not a feed
in that case. -->

Expand All @@ -28147,8 +28153,8 @@ user reload must be equivalent to .reload()

<li>If <span><var title="">s</var>[<var
title="">pos</var>]</span> equal 0x3E, then increase <var
title="">pos</var> by 1 and jump back to step 5 in the overall
algorithm in this section.</li>
title="">pos</var> by 1 and jump back to the step labelled
<i>loop start</i> in the overall algorithm in this section.</li>

<li>Otherwise, return to step 1 in these substeps.</li>

Expand All @@ -28167,8 +28173,9 @@ user reload must be equivalent to .reload()
<li>If <span><var title="">s</var>[<var
title="">pos</var>]</span> and <span><var title="">s</var>[<var
title="">pos</var>+1]</span> equal 0x3F and 0x3E respectively,
then increase <var title="">pos</var> by 1 and jump back to
step 5 in the overall algorithm in this section.</li>
then increase <var title="">pos</var> by 1 and jump back to the
step labelled <i>loop start</i> in the overall algorithm in this
section.</li>

<li>Otherwise, return to step 1 in these substeps.</li>

Expand Down

0 comments on commit ccebe52

Please sign in to comment.