[Webkit-unassigned] [Bug 76707] Two HTML line breaks are generated with XSL transformation of <br/>

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Jan 22 20:18:24 PST 2012


https://bugs.webkit.org/show_bug.cgi?id=76707





--- Comment #8 from Rob S. <RobS.webkit6 at MailScreen.com>  2012-01-22 20:18:24 PST ---
Interesting. If you didn't need any JavaScript you could simply change from <xsl:output method="html"/> to <xsl:output method="xml"/> and render it as an XML document instead of HTML.  Unfortunately, when the document is rendered using the XML DOM, much of the JavaScript code, which previously worked with the HTML DOM, fails after that change is made.  I just tried it with the site I'm working on (http://TVSeries.com/) and various things stopped working, including the backgrounds, dynamic vertical positioning, the Google +1 button, etc, because it's throwing a bunch of undefined object errors.  The forums seem to indicate the same issue occurs when using <xsl:output method="xml"/> with IE, but I'm currently on a Mac without an easy way to test it.

I updated my minimal code test cases.  http://www.ExampleOnly.com/br-tag/test2.html clearly shows that with <xsl:output method="xml"/>, in Firefox at least, the document is an XMLDocument with no HTML-specific objects, such as document.body, which is what causes the JavaScript code to break, while http://www.ExampleOnly.com/br-tag/test1.html shows the document is an HTMLDocument.

So, is there any suggestion on the best way to render a single <br/> in the resulting document when it needs to support JavaScript and therefore requires the HTML DOM (<xsl:output method="html"/>)?  Maybe the workaround I had found provides one option that wasn't too far off - that is, to use JavaScript to detect when the user agent is a WebKit browser and then loop through the document tree to replace all instances of <br><br> with <br/> (I thought HTML 5 was supposed to help us avoid this kind of browser-specific funniness).  Wouldn't you also need to do the same thing with some of the other self-closed elements such as <hr/> which would become <hr></hr>, presumably equivalent to <hr><hr>? (Some elements created by self-closing tags would be OK, such as <img .../> becoming <img ...></img>, <embed .../> becoming <embed ...></embed>, etc.)

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list