Re: Please don't shout or throw things at this respec newbie

On 03/06/2013 18:36 , Tobie Langel wrote:
> On Monday, June 3, 2013 at 6:25 PM, Robin Berjon wrote:
>> So I ran your document with the non-optimised build and I get the same
>> results. I haven't been able to debug it fully but I believe that the
>> problem boils down to this: when using specStatus=unofficial, the W3C
>> logo is not prepended to the draft, whereas it is for all other modes.
>> jQuery notices that there's an <img> in the template we're injecting,
>> and it does something with it to handle the /> (I'm not exactly clear on
>> what just yet) which browsers don't like in an XHTML context.
>
> It uses document.createElement[1].
> [1]: http://api.jquery.com/jQuery/#creating-new-elements

Except when it doesn't. In this case it doesn't :)

I've traced down the unhappiness to this line in jQuery:

tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[2];

Browsers do in fact accept XHTML for innerHTML, but they are doing it 
pretty seriously: any WF error and it's halt and catch fire.

The root cause here is that there was a WF error in one of the 
templates. This is expected: in HTML you can skip closing your <p>, and 
the templates are HTML.

I've fixed this (but haven't shipped yet, I need more testing with some 
of the modifications I made), and with this fix Henry's document works.

Having said that, I would strongly advise against using XHTML here. It's 
just not a path sufficiently trodden to be safe.

-- 
Robin Berjon - http://berjon.com/ - @robinberjon

Received on Monday, 3 June 2013 20:53:02 UTC