Bug 12740 - www.bmw.com page doesn't work
: www.bmw.com page doesn't work
Status: RESOLVED FIXED
: WebKit
HTML DOM
: 418.x
: Macintosh Mac OS X 10.4
: P2 Major
Assigned To:
: http://www.bmw.com/
: InRadar
:
:
  Show dependency treegraph
 
Reported: 2007-02-12 00:49 PST by
Modified: 2007-05-12 17:32 PST (History)


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


Note

You need to log in before you can comment on or make changes to this bug.


Description From 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 From 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 From 2007-05-11 14:21:07 PST -------
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

jklimeck@mac.com
------- Comment #3 From 2007-05-11 15:38:41 PST -------
Adding NeedsRadar keyword since this is a fairly high-profile web site (and brand).
------- Comment #4 From 2007-05-12 02:39:52 PST -------
Created an attachment (id=14511) [details]
test case
------- Comment #5 From 2007-05-12 02:41:48 PST -------
This is a parsing problem; Firefox DOM tree matches html5lib one.

<div style="display:none">
  <table>
    <div>
      <table>
      </table>
    </div>
</div>
------- Comment #6 From 2007-05-12 02:58:37 PST -------
Hmmm, WebKit basically does what I implemented here, which seems more sensible to me than the behavior I'm seeing in Firefox.
------- Comment #7 From 2007-05-12 03:03:03 PST -------
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 From 2007-05-12 03:05:58 PST -------
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 From 2007-05-12 03:07:27 PST -------
This example shows that my analysis of what Firefox is doing is correct.

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

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

<p>SUCCESS</p>
</body>


I don't even have the second close </div> in that example, proving that the first </div> closed up the outermost one.
------- Comment #10 From 2007-05-12 03:18:03 PST -------
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 From 2007-05-12 03:36:26 PST -------
Created an attachment (id=14513) [details]
Easy, the html5 spec covers this.

Will land the test case.
------- Comment #12 From 2007-05-12 03:37:53 PST -------
(From update of attachment 14513 [details])
r=me
------- Comment #13 From 2007-05-12 03:48:28 PST -------
<rdar://problem/5199034>
------- Comment #14 From 2007-05-12 14:38:48 PST -------
Fixed in r21428.