Bug 38901 - empty divs (<div />) are not properly handled
Summary: empty divs (<div />) are not properly handled
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 525.x (Safari 3.2)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-11 06:08 PDT by Milian Wolff
Modified: 2010-05-13 00:34 PDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Milian Wolff 2010-05-11 06:08:17 PDT
Empty divs are not properly handled in at least safari 3.2.1 and QWebKit from Qt 4.6.3. To reproduce see attached HTML and use e.g. the webinspector to
investigate how WebKit interprets the DOM:

it wrongly turns

    <div /><div />

into

    <div><div></div></div>

instead of

    <div></div><div></div>
Comment 1 Alexey Proskuryakov 2010-05-12 14:10:41 PDT
This is correct parsing. It matches HTML5 and Firefox - and although I didn't test IE, I'm pretty sure it works the same.

Note that "<div />" is exactly equivalent to "<div>" - the self-closing syntax is not supported in HTML, and all browsers simply ignore the slash.
Comment 2 Milian Wolff 2010-05-12 23:11:43 PDT
Just to get this right:

1) the document is XHTML conform and has a proper doctype for that, hence should imo adhere to the XML syntax - making this _not_ an invalid request
2) do you have any documentation / links to the standard that describe the behavior for plain HTML? I always thought that <tag /> was equivalent to <tag></tag> even there and afair it works for at least <a /> in Firefox

or do you simply ignore it because the others also ignore it?

thanks, have a nice day
Comment 3 Alexey Proskuryakov 2010-05-13 00:34:22 PDT
Please read <http://hixie.ch/advocacy/xhtml> for an explanation of why this is not XHTML, even if it looks like such to human eyes.

> 2) do you have any documentation / links to the standard that describe the behavior for plain HTML?

Any version of HTML standard would do. HTML5 describes this in most detail.