[HTML5]misnested tag parsing problem

RESOLVED INVALID

Status

()

Core
HTML: Parser
--
minor
RESOLVED INVALID
8 years ago
8 years ago

People

(Reporter: Masahiro YAMADA, Unassigned)

Tracking

Trunk
x86
Windows XP
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

8 years ago
Created attachment 468946 [details]
testcase

Mozilla/5.0 (Windows NT 5.1; rv:2.0b4pre) Gecko/20100809 Minefield/4.0b4pre

When html5parser is enabled,
Misnested html
<p><code id="c">foo</p><p id="p2">bar</code></p>
is parsed as
<p><code id="c">foo</code></p><p id="p2"><code id="c">bar</code></p>
(parent node of "bar" has id "c")
Is this correct behavior ?

I think it should be parsed as
<p><code id="c">foo</code></p><p id="p2"><code>bar</code></p>

Steps to reproduce:
1.enable html5 parser
2.open testcase

Expected result:
 color of "bar" is green

Actual result:
 color of "bar" is red.

FYI:
  When html5 parser is disabled, color of "bar" is orange
  because it is parsed as <p><code id="c">foo</code></p><p id="p2">bar</p>
> color of "bar" is red.

Also red in Webkit, note.  And the HTML5 spec parser's handling of this sort of markup was largely modeled on webkit.

> Is this correct behavior ?

Per the HTML5 spec, yes.  See http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.html#adoptionAgency item 6 sub-item 4.  Note that a "token" in this case includes all the attributes of the element (e.g. see http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.html#before-attribute-name-state the "Anything else" case).
Status: NEW → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.