Bug 17421

Summary: Lack of end tag for SELECT element causes the rest of page to not be rendered
Product: WebKit Reporter: Robert Blaut <webkit>
Component: DOMAssignee: Robert Blaut <webkit>
Status: VERIFIED FIXED    
Severity: Normal CC: ap, hyatt, ian
Priority: P2 Keywords: HasReduction, InRadar
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
minimal test case
none
Fix for the bug reflecting the latest HTML5 spec changes
none
Improved patch for unclosed SELECT element darin: review+

Description Robert Blaut 2008-02-18 00:13:57 PST
The problem was found on the above page. Lack of </selection> tag causes blank a rest of the page rendered. The problem is only visible in Webkit. Other tested browsers: Minefield and Opera has no problem with it. <input> element in these browsers automatically closes <select> element in DOM. Webkit ignores the <input> element.

Check DOM tree in all three browsers: http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!doctype%20html%3E%3Chtml%3E%3Cbody%3E%3Cp%3EThere%20should%20be%20GREEN%20bar%20below%3C%2Fp%3E%3Cselect%3E%3Cinput%3E%3Cp%20style%3D%22background-color%3Alime%3B%22%3EPASS%3C%2Fp%3E%3C%2Fbody%3E%3C%2Fhtml%3E
Comment 1 Robert Blaut 2008-02-18 00:14:21 PST
Created attachment 19184 [details]
minimal test case
Comment 2 Robert Blaut 2008-02-25 05:03:16 PST
<rdar://problem/5762895>
Comment 3 Robert Blaut 2008-03-04 04:41:09 PST
I removed URL since the </select> error on a reported page was corrected. 

I wonder if we should fix the bug since HTML5lib renders the test case identically as Webkit today? I don't know if HTML5 parsing compatibility has absolute priority despite other browsers current behavior.
Comment 4 Alexey Proskuryakov 2008-03-04 13:23:36 PST
I do not know whether this is a bug in the spec, or intentional change. Asking on whatwg@whatwg.org is probably the way to go, unless Dave or Ian choose to comment here.
Comment 5 Ian 'Hixie' Hickson 2008-03-04 14:26:52 PST
It's the <input> that's the issue. It should cause a </select> to be implied. I'll fix it in the spec. Ping me if it's not fixed by next week.
Comment 6 Robert Blaut 2008-03-04 14:39:47 PST
(In reply to comment #5)
> It's the <input> that's the issue. It should cause a </select> to be implied.
> I'll fix it in the spec. Ping me if it's not fixed by next week.
> 

Ian as far as I tested <textarea> also closes <select> element in Gecko, Presto and IE 6.

Test case: http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%3Cp%3EThere%20should%20be%20GREEN%20bar%20below%3C%2Fp%3E%3Cselect%3E%3Ctextarea%3E%3C%2Ftextarea%3E%3Cp%20style%3D%22background-color%3Alime%3B%22%3EPASS%3C%2Fp%3E
Comment 7 Ian 'Hixie' Hickson 2008-05-24 02:45:21 PDT
I fixed the spec.
Comment 8 Robert Blaut 2008-06-02 01:47:03 PDT
Created attachment 21456 [details]
Fix for the bug reflecting the latest HTML5 spec changes

Thank you Ian for fixing the specification. Here is my fix proposition with test case attached.
Comment 9 Darin Adler 2008-06-08 17:59:08 PDT
Comment on attachment 21456 [details]
Fix for the bug reflecting the latest HTML5 spec changes

This patch is good.

What would make it better would be to add a call to reportError here so the web inspector would explain the error in the page. I think the call would be:

    reportError(MisplacedContentRetryError, &localName, &currentTagName)

I also think that it would be better to have a test with a text result rather than a Mac-specific render tree result.

r=me, as-is
Comment 10 Robert Blaut 2008-06-08 23:24:10 PDT
Comment on attachment 21456 [details]
Fix for the bug reflecting the latest HTML5 spec changes

Thank you Darin for usefull review. I'll improve the patch soon. So for now I clear the review flag.
Comment 11 Robert Blaut 2008-06-09 02:19:14 PDT
Created attachment 21591 [details]
Improved patch for unclosed SELECT element

I've made changes based on Darin suggestions.
Comment 12 Darin Adler 2008-06-09 06:49:12 PDT
Comment on attachment 21591 [details]
Improved patch for unclosed SELECT element

r=me
Comment 13 Mark Rowe (bdash) 2008-06-22 18:16:37 PDT
Landed in r34734.