Skip to content

Commit

Permalink
Support rb and rtc elements in the parser (ruby)
Browse files Browse the repository at this point in the history
Ruby parsing got forked in two directions. This aligns the parser with the majority of implementations. Remaining implementations have agreed to make these changes as well, hopefully leading us back to fully interoperable HTML parsing.

This does not make either rb or rtc elements conforming. It also does not change any rendering rules. That is separately discussed in #121.
  • Loading branch information
annevk committed Sep 10, 2015
1 parent 9d4276a commit 5a93e81
Showing 1 changed file with 48 additions and 49 deletions.
97 changes: 48 additions & 49 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -103826,9 +103826,10 @@ document.body.appendChild(text);

<p>When the steps below require the UA to <dfn>generate implied end tags</dfn>, then, while the
<span>current node</span> is a <code>dd</code> element, a <code>dt</code> element, an
<code>li</code> element, an <code>option</code> element, an <code>optgroup</code> element, a
<code>p</code> element, an <code>rp</code> element, or an <code>rt</code> element, the UA must pop
the <span>current node</span> off the <span>stack of open elements</span>.</p>
<code>li</code> element, an <code>optgroup</code> element, an <code>option</code> element, a
<code>p</code> element, an <code>rb</code> element, an <code>rp</code> element, an <code>rt</code>
element, or an <code>rtc</code> element, the UA must pop the <span>current node</span> off the
<span>stack of open elements</span>.</p>

<p>If a step requires the UA to generate implied end tags but lists an element to exclude from the
process, then the UA must perform the above steps as if that element was not in the above
Expand All @@ -103837,11 +103838,12 @@ document.body.appendChild(text);
<p>When the steps below require the UA to <dfn>generate all implied end tags thoroughly</dfn>,
then, while the <span>current node</span> is a <code>caption</code> element, a
<code>colgroup</code> element, a <code>dd</code> element, a <code>dt</code> element, an
<code>li</code> element, an <code>option</code> element, an <code>optgroup</code> element, a
<code>p</code> element, an <code>rp</code> element, an <code>rt</code> element, a
<code>tbody</code> element, a <code>td</code> element, a <code>tfoot</code> element, a
<code>th</code> element, a <code>thead</code> element, or a <code>tr</code> element, the UA must
pop the <span>current node</span> off the <span>stack of open elements</span>.</p>
<code>li</code> element, an <code>optgroup</code> element, an <code>option</code> element, a
<code>p</code> element, an <code>rb</code> element, an <code>rp</code> element, an <code>rt</code>
element, an <code>rtc</code> element, a <code>tbody</code> element, a <code>td</code> element, a
<code>tfoot</code> element, a <code>th</code> element, a <code>thead</code> element, or a
<code>tr</code> element, the UA must pop the <span>current node</span> off the
<span>stack of open elements</span>.</p>



Expand Down Expand Up @@ -104749,11 +104751,11 @@ document.body.appendChild(text);
<li><p>If there is a node in the <span>stack of open elements</span> that is not either a
<code>dd</code> element, a <code>dt</code> element, an <code>li</code> element, an
<code>optgroup</code> element, an <code>option</code> element, a <code>p</code> element, an
<code>rp</code> element, an <code>rt</code> element, a <code>tbody</code> element, a
<code>td</code> element, a <code>tfoot</code> element, a <code>th</code> element, a
<code>thead</code> element, a <code>tr</code> element, the <code>body</code> element, or the
<code>html</code> element, then this is a <span>parse error</span>.</p></li> <!-- (some of
those are fragment cases) -->
<code>rb</code> element, an <code>rp</code> element, an <code>rt</code> element, an
<code>rtc</code> element, a <code>tbody</code> element, a <code>td</code> element, a
<code>tfoot</code> element, a <code>th</code> element, a <code>thead</code> element, a
<code>tr</code> element, the <code>body</code> element, or the <code>html</code> element, then
this is a <span>parse error</span>.</p></li> <!-- (some of those are fragment cases) -->

<li><p><span>Stop parsing</span>.</p></li>

Expand All @@ -104773,12 +104775,13 @@ document.body.appendChild(text);
<p>Otherwise, if there is a node in the <span>stack of open elements</span> that is not either a
<code>dd</code> element, a <code>dt</code> element, an <code>li</code> element, an
<code>optgroup</code> element, an <code>option</code> element, a <code>p</code> element, an
<code>rp</code> element, an <code>rt</code> element, a <code>tbody</code> element, a
<code>td</code> element, a <code>tfoot</code> element, a <code>th</code> element, a
<code>thead</code> element, a <code>tr</code> element, the <code>body</code> element, or the
<code>html</code> element, then this is a <span>parse error</span>.</p> <!-- (some of those are
fragment cases, e.g. for <tbody> you'd have hit the first paragraph since the <body> wouldn't be
in scope, unless it was a fragment case) -->
<code>rb</code> element, an <code>rp</code> element, an <code>rt</code> element, an
<code>rtc</code> element, a <code>tbody</code> element, a <code>td</code> element, a
<code>tfoot</code> element, a <code>th</code> element, a <code>thead</code> element, a
<code>tr</code> element, the <code>body</code> element, or the <code>html</code> element, then
this is a <span>parse error</span>.</p> <!-- (some of those are fragment cases, e.g., for
<tbody> you'd have hit the first paragraph since the <body> wouldn't be in scope, unless it was
a fragment case) -->

<!-- If we ever change the frameset-ok flag to an insertion mode, then we'd have to somehow keep
track of its state when we switch to after-body. -->
Expand All @@ -104801,12 +104804,13 @@ document.body.appendChild(text);
<p>Otherwise, if there is a node in the <span>stack of open elements</span> that is not either a
<code>dd</code> element, a <code>dt</code> element, an <code>li</code> element, an
<code>optgroup</code> element, an <code>option</code> element, a <code>p</code> element, an
<code>rp</code> element, an <code>rt</code> element, a <code>tbody</code> element, a
<code>td</code> element, a <code>tfoot</code> element, a <code>th</code> element, a
<code>thead</code> element, a <code>tr</code> element, the <code>body</code> element, or the
<code>html</code> element, then this is a <span>parse error</span>.</p> <!-- (some of those are
fragment cases, e.g. for <tbody> you'd have hit the first paragraph since the <body> wouldn't be
in scope, unless it was a fragment case) -->
<code>rb</code> element, an <code>rp</code> element, an <code>rt</code> element, an
<code>rtc</code> element, a <code>tbody</code> element, a <code>td</code> element, a
<code>tfoot</code> element, a <code>th</code> element, a <code>thead</code> element, a
<code>tr</code> element, the <code>body</code> element, or the <code>html</code> element, then
this is a <span>parse error</span>.</p> <!-- (some of those are fragment cases, e.g., for
<tbody> you'd have hit the first paragraph since the <body> wouldn't be in scope, unless it was
a fragment case) -->

<!-- If we ever change the frameset-ok flag to an insertion mode, then we'd have to somehow keep
track of its state when we switch to after-body. -->
Expand Down Expand Up @@ -105652,32 +105656,25 @@ document.body.appendChild(text);

</dd>

<dt>A start tag whose tag name is one of: "rp", "rt"</dt>
<dt>A start tag whose tag name is one of: "rb", "rtc"</dt>
<dd>

<!-- the parsing rules for ruby really don't match IE much at all, but in practice the markup
used is very simple and so strict compatibility with IE isn't required. For example, as
defined here we get very, very different behaviour than IE for pathological cases like:

<ruby><ol><li><p>a<rt>b
<ruby>a<rt>b<p>c

But in practice most ruby markup falls into these cases:
<p>If the <span>stack of open elements</span> <span data-x="has an element in scope">has a
<code>ruby</code> element in scope</span>, then <span>generate implied end tags</span>. If the
<span>current node</span> is not now a <code>ruby</code> element, this is a
<span>parse error</span>.</p>

<ruby>a<rt>b</ruby>
<ruby>a<rp>b<rt>c<rp>d</ruby>
<ruby>a<rt>b</rt></ruby>
<ruby>a<rp>b</rp><rt>c</rt><rp>d</rp></ruby>
<p><span>Insert an HTML element</span> for the token.</p>

(Note: the comment above was written when this section did something slightly more radical
for handling <rp> and <rt> elements, so it might be out of date now.)
</dd>

-->
<dt>A start tag whose tag name is one of: "rp", "rt"</dt>
<dd>

<p>If the <span>stack of open elements</span> <span data-x="has an element in scope">has a
<code>ruby</code> element in scope</span>, then <span>generate implied end tags</span>. If the
<span>current node</span> is not then a <code>ruby</code> element, this is a <span>parse
error</span>.</p>
<code>ruby</code> element in scope</span>, then <span>generate implied end tags</span>, except
for <code>rtc</code> elements. If the <span>current node</span> is not now a <code>rtc</code>
element or a <code>ruby</code> element, this is a <span>parse error</span>.</p>

<p><span>Insert an HTML element</span> for the token.</p>

Expand Down Expand Up @@ -111991,7 +111988,9 @@ if (s = prompt('What is your name?')) {
<dd><p>Use the "<code>text/plain</code>" <span>MIME type</span> instead.</p></dd>

<dt><dfn><code>rb</code></dfn></dt>
<dd><p>Providing the ruby base directly inside the <code>ruby</code> element is sufficient; the <code>rb</code> element is unnecessary. Omit it altogether.</p></dd>
<dt><dfn><code>rtc</code></dfn></dt>
<dd><p>Providing the ruby base directly inside the <code>ruby</code> element or using nested
<code>ruby</code> elements is sufficient.</p></dd>

<dt><dfn><code>strike</code></dfn></dt>
<dd><p>Use <code>del</code> instead if the element is marking an edit, otherwise use <code>s</code> instead.</p></dd>
Expand Down Expand Up @@ -113396,10 +113395,10 @@ if (s = prompt('What is your name?')) {
<hr>

<p>The <code>blink</code>, <code>bgsound</code>, <code>isindex</code>, <code>multicol</code>,
<code>nextid</code>, <code>rb</code>, and <code>spacer</code> elements must use the
<code>HTMLUnknownElement</code> interface.</p> <!-- has to be explicitly listed because
technically we define the elements in the spec, albeit as obsolete, and then we say that only
elements not defined in this spec use HTMLUnknownElement. -->
<code>nextid</code>, and <code>spacer</code> elements must use the <code>HTMLUnknownElement</code>
interface.</p> <!-- has to be explicitly listed because technically we define the elements in the
spec, albeit as obsolete, and then we say that only elements not defined in this spec use
HTMLUnknownElement. -->

<hr>

Expand Down

0 comments on commit 5a93e81

Please sign in to comment.