Bug 13240
Summary: | World of Warcraft site fails because it expects an implicit <tbody> as the first child of a <table> | ||
---|---|---|---|
Product: | WebKit | Reporter: | Darin Adler <darin> |
Component: | Evangelism | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED FIXED | ||
Severity: | Normal | CC: | ap, webkit |
Priority: | P2 | Keywords: | NeedsReduction |
Version: | 523.x (Safari 3) | ||
Hardware: | Mac | ||
OS: | OS X 10.4 | ||
URL: | http://www.worldofwarcraft.com/info/basics/factions/hellfire/hellfire.xml |
Darin Adler
I ran into a problem on a World of Warcraft page:
http://www.worldofwarcraft.com/info/basics/factions/hellfire/hellfire.xml
It turned out to be some code that assumes that a <table> gets a <tbody> automatically created. For this markup:
<table><tr></tr></table>
IE creates a <tbody> element in the DOM. Firefox does not do this. The page doesn't work with Firefox either.
I'm not sure what we should do about this difference in behavior.
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Darin Adler
Same thing with just a plain empty table: <table></table>. IE supplies a <tbody>.
Darin Adler
Further, if there's whitespace at the start of the table, the <tbody> replaces it instead of being added after it. So the <tbody> is the first child of the table. That's what the code on the website depends on. It gets the table and then calls childNodes[0].appendChild to add a row to the table. This relies on the table body being node 0. But the markup has whitespace, something like this:
<table>
<tr></tr>
</table>
IE adds the <tbody> and seems to discard the whitespace! I'm not sure what we can do to be compatible with a site like this.
Darin Adler
Strangely, there is code to create implicit tbody elements in the HTML parser that looks like dead code to me. For example, HTMLTableElement::addChild says "The creation of <tbody> elements relies on the 'childAllowed' check", which seems to imply that some types of children, perhaps <tr> elements for example, would return false from childAllowed and then trigger the code in HTMLParser::handleError. But there's no implementation of childAllowed that prevents such elements from getting added! So I think the HTML parser code is never reached.
But even if that code to create implicit tbody elements runs, it doesn't put the body *before* the whitespace; so it doesn't make the World of Warcraft site work.
Darin Adler
Somehow, this site works in Firefox even though my reductions of the problem don't!
Alexey Proskuryakov
Using Hixie's live DOM viewer <http://software.hixie.ch/utilities/js/live-dom-viewer/>, I see TBODY being created in WebKit - the behavior seems to fully match Firefox.
Darin Adler
OK, I guess I was reading the code wrong. The <tbody> does get created, but the site's code expects it to be the first child of the <table>, but instead we have whitespace as the first child. Why does this work in Firefox?
Darin Adler
Works fine if we spoof as Firefox. So that explains why they're not failing the same way we are.
Robert Blaut
(In reply to comment #7)
> Works fine if we spoof as Firefox. So that explains why they're not failing the
> same way we are.
>
So it's Evangelism bug. I checked the site using r30090 and the site looks good for me. Not broken layout so it should be considered ad FIXED