Bug 12740 - www.bmw.com page doesn't work
Summary: www.bmw.com page doesn't work
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 418.x
Hardware: Mac OS X 10.4
: P2 Major
Assignee: Dave Hyatt
URL: http://www.bmw.com/
Keywords: InRadar
Depends on:
Reported: 2007-02-12 00:49 PST by jhorneratl
Modified: 2007-05-12 17:32 PDT (History)
8 users (show)

See Also:

test case (161 bytes, text/html)
2007-05-12 02:39 PDT, Alexey Proskuryakov
no flags Details
Easy, the html5 spec covers this. (829 bytes, patch)
2007-05-12 03:36 PDT, Dave Hyatt
mjs: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description jhorneratl 2007-02-12 00:49:00 PST
I tried out the bmw.com website, and when I tried to select my country or region from the list, the list wouldn't open and the page formatting went crazy.
Comment 1 David Kilzer (:ddkilzer) 2007-02-12 01:42:47 PST
Confirmed with a local debug build of WebKit r19572 with Safari 2.0.4 (419.3) on Mac OS X 10.4.8 (8L127).  This is not a regression as shipping Safari looks and acts about the same.

I don't see any JavaScript errors in the JS Console, nor do I see any console output when visiting the page.

Comment 2 John Klimeck 2007-05-11 14:21:07 PDT
I can also confirm this, 05/11/2007, still exists in Safari 2.0.4 (419.3)
and today's latest WebKit build.

Want to lease a BMW 328i, went to page in Safari.

www.bmw.com main webpage is totally messed up and useless in Safari, works with Firefox

(QA engineer on FCP 4 at Apple, 2001-2003

Please fix, thanks

Comment 3 David Kilzer (:ddkilzer) 2007-05-11 15:38:41 PDT
Adding NeedsRadar keyword since this is a fairly high-profile web site (and brand).

Comment 4 Alexey Proskuryakov 2007-05-12 02:39:52 PDT
Created attachment 14511 [details]
test case
Comment 5 Alexey Proskuryakov 2007-05-12 02:41:48 PDT
This is a parsing problem; Firefox DOM tree matches html5lib one.

<div style="display:none">
Comment 6 Dave Hyatt 2007-05-12 02:58:37 PDT
Hmmm, WebKit basically does what I implemented here, which seems more sensible to me than the behavior I'm seeing in Firefox.
Comment 7 Dave Hyatt 2007-05-12 03:03:03 PDT
WebKit's model is to detect when you enter stray table content.  When this happens you pull that content out and put it before the table.  (Firefox does this as well for the div that is inside the table.  Where we differ is with what happens next.  We assume that until we encounter a <tr> or <td> that we are still inside that stray table content.  I guess Mozilla assumes <table> should end the stray table content section.

Because we put the second <table> inside the <div>, when we hit the first close</div>, we close up the stray table content and then we are back inside the outer table.  The second </div> is not sufficient to close up (since </div> never wins when inside a <table>), and so the <p> ends up inside the <div> as well.

Firefox closes up the stray content the minute it hits the second table, and so the first </div> encountered actually closed up the *outer* div.  The second </div> is then ignored.  The <p> is then outside the outer div.

I'll have to go study the HTML5 spec.  It may be that <table> is on the list of tags to be considered as "ending" stray table content.  I'm not so sure that it should be though, since you should really be looking for things that would logically be elements of *your* table (like <tr> and <td> and <tbody> etc.).
Comment 8 Dave Hyatt 2007-05-12 03:05:58 PDT
My guess is that html5lib just parses this dumbly as a tree and doesn't do any of the stray table content stuff that real browsers have to do.
Comment 9 Dave Hyatt 2007-05-12 03:07:27 PDT
This example shows that my analysis of what Firefox is doing is correct.

<p>Should say "SUCCESS" below:</p>

<div style="border:2px solid red">
    <div style="border:2px solid green">
      <table border=2><tr><td>Table


I don't even have the second close </div> in that example, proving that the first </div> closed up the outermost one.

Comment 10 Dave Hyatt 2007-05-12 03:18:03 PDT
In Firefox and html5lib and IE a <table> encountered while in stray table content actually has the effect of closing up the original table!

This is a rule we are simply missing.  I'll try implementing it and see what breaks.
Comment 11 Dave Hyatt 2007-05-12 03:36:26 PDT
Created attachment 14513 [details]
Easy, the html5 spec covers this.

Will land the test case.
Comment 12 Maciej Stachowiak 2007-05-12 03:37:53 PDT
Comment on attachment 14513 [details]
Easy, the html5 spec covers this.

Comment 13 Dave Hyatt 2007-05-12 03:48:28 PDT
Comment 14 Dave Hyatt 2007-05-12 14:38:48 PDT
Fixed in r21428.