H1 tag is not inside the p tag
Categories
(Firefox :: Untriaged, defect)
Tracking
()
People
(Reporter: tourcoder, Unassigned)
Details
Attachments
(1 file)
|
21.40 KB,
image/png
|
Details |
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:100.0) Gecko/20100101 Firefox/100.0
Steps to reproduce:
(1) write some code like following, and save it to a html file
<p><h1>title</h1></p>
<p>this is content</p>
(2) open this html file in Chrome, Safari, Firefox or Edge.
(3) Developer tools -> Inspect, you will find the above code is turned to
<p></p>
<h1>title</h1>
<p></p>
<p>this is content</p>
Actual results:
The code is changed.
Expected results:
The code show the same.
Comment 1•3 years ago
|
||
I don't know if this might be a parser issue or a devtools issue. This doesn't look like a security issue, so I'm going to unhide it.
Comment 2•3 years ago
|
||
Not a security problem in any case.
If three completely different browser engines agree you should check your understanding before assuming they all got it wrong. This is the way HTML and the HTML parser are defined. For example, <h1> cannot be inside a <p>, so encountering one implies a missing </p>. Likewise, encountering a nonsensical un-started closing tag causes the insertion of the matching start tag. Please see the specification.
Description
•