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.
Same thing with just a plain empty table: <table></table>. IE supplies a <tbody>.
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.
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.
Somehow, this site works in Firefox even though my reductions of the problem don't!
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.
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?
Works fine if we spoof as Firefox. So that explains why they're not failing the same way we are.
(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