Closed Bug 1770685 Opened 3 years ago Closed 3 years ago

H1 tag is not inside the p tag

Categories

(Firefox :: Untriaged, defect)

Firefox 100
defect

Tracking

()

RESOLVED INVALID

People

(Reporter: tourcoder, Unassigned)

Details

Attachments

(1 file)

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.

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.

Group: firefox-core-security

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.

Status: UNCONFIRMED → RESOLVED
Closed: 3 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: