Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 316551

Summary: [parser] Is HTML DOM correctly treating implicitly-closed tags?
Product: [WebTools] WTP Source Editing Reporter: Nick Sandonato <nsand.dev>
Component: wst.htmlAssignee: Nick Sandonato <nsand.dev>
Status: RESOLVED FIXED QA Contact: Nitin Dahyabhai <thatnitind>
Severity: normal    
Priority: P3 CC: ccc
Version: 3.0.5Flags: thatnitind: review+
Target Milestone: 3.0.5 P   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
patch
none
patch none

Description Nick Sandonato CLA 2010-06-10 18:49:03 EDT
+++ This bug was initially created as a clone of Bug #308412 for the purposes of backporting to 3.0.5p +++

Take the following HTML source:

<ul>
    <li>Item 1
    <li>Item 2
    <li>Item 3
</ul>

and this:

<ul>
    <li>Item 1</li>
    <li>Item 2</li>
    <li>Item 3</li>
</ul>

In WTP, the DOM is constructed with the subsequent elements of the unterminated li elements as descendents.

Both IE and Firefox construct the same DOM for both chunks of source, that is, the li elements are siblings.

W3C documents (e.g. http://www.w3.org/MarkUp/html3/HTMLandSGML.html) state that some tags are implicitly terminated based on their position. The li tag is one such tag.

Should the WTP DOM take implicitly-closed tags into consideration? Is the current WTP DOM correct?
Comment 1 Nick Sandonato CLA 2010-06-10 19:01:07 EDT
Created attachment 171678 [details]
patch

Patch that will allow for elements with omissible end tags.
Comment 2 Nitin Dahyabhai CLA 2010-06-13 21:14:43 EDT
Nick, the addition of a method to an existing interface needs a great amount of care.  Could you also ensure that the o.e.w.html.core requires at least this version of o.e.w.xml.core?
Comment 3 Nick Sandonato CLA 2010-06-14 11:42:44 EDT
Created attachment 171843 [details]
patch

Updated the patch. Instead of adding a new method to the interface, I wrote an extension. I also updated the min version for o.e.w.html.core's dependency on o.e.w.xml.core to 1.1.312.
Comment 4 Carl Anderson CLA 2010-07-09 17:09:13 EDT
Committed to R3_0_5_patches
Comment 5 Carl Anderson CLA 2010-07-09 17:09:27 EDT
Committed to R3_0_5_patches