Closed Bug 327637 Opened 19 years ago Closed 19 years ago

Empty <div /> tags appear as unclosed in DOM inspector (and internally?)

Categories

(Firefox :: General, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 135425

People

(Reporter: tal, Unassigned)

Details

Attachments

(1 file)

199 bytes, application/xhtml+xml
Details
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8.0.1) Gecko/20060111 Firefox/1.5.0.1 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8.0.1) Gecko/20060111 Firefox/1.5.0.1 No-content <div> tags, e.g., <div id="test" />, appear as unclosed tags in the DOM inspector, i.e., the following nodes appear as *children* of this node. Reproducible: Always Steps to Reproduce: 1. Create the following XHTML file: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head></head> <body> <div id="3" /> <br /> <p>hello</p> </body> </html> (This also works without the DOCTYPE specification.) 2. Load the file in FireFox. 3. Open the DOM Inspector. Actual Results: The DOM tree (sans #text nodes) appears as: +- #document +- HTML +- HEAD +- BODY +- DIV (id=3) +- BR <-- <br /> and <p> are children of <div> +- P Expected Results: The DOM tree (sans #text nodes) should appear as: +- #document +- HTML +- HEAD +- BODY +- DIV (id=3) +- BR <-- <br /> and <p> are siblings of <div> +- P Closing the <div> tag using the full syntax, <div id="3"></div>, works fine. I am not sure if the problem is with the DOM inspector, or with the parsing mechanism; I suppose this can be tested by applying some CSS property to the <div> and checking if it affects the <p> that follows it. If it's not just a DOM inspector issue, then as the popularity of XHTML and CSS grows, this bug could lead to strange effects...
Confirmed Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20060214 Firefox/1.5 ID:2006021404 With this page: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head></head> <body> <div id="3" style="visibility:hidden;" /> <br /> <p>hello</p> </body> </html> Not only the div dissapear but also <p>hello</p>. The category of this bug should probably be changed to Core:DOM.
You are probably serving/viewing the XHTML as text/html, so it is parsed by the HTML, not XML , parser. See bug 135425 for details. *** This bug has been marked as a duplicate of 135425 ***
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → DUPLICATE
Attached file testcase
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: