Unfortunately, there's not really a whole lot that we can do on our
end to fix a problem like that - short of including a full HTML
parser/DOM generator.

Now, I've written one:
http://ejohn.org/blog/pure-javascript-html-parser/

but it's probably just better to make sure that your injected HTML is
well-formed.

--John



On Mon, Jun 22, 2009 at 6:45 PM, Daniel
Friesen<nadir.seen.f...@gmail.com> wrote:
>
> I ran into another IE issue with unclosed tag syntax inside node
> creation (I personally like to leave the / out unless necessary most of
> the time, especially since it flows fairly nice with .text(userVar)).
>
> http://jsbin.com/ejote
>
> <span></span>
> <span />
> <span/>
> <span>
> <span class=foo />
>
> All work in ie7, ie8, opera, firefox, and midori.
>
> However:
> <span class=foo>
> <span class="foo">
>
> Fail in ie7 and ie8 while they work in firefox, midori, and opera.
>
> Filed as: http://dev.jquery.com/ticket/4806
>
> ~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://daniel.friesen.name]
>
> John Resig wrote:
>> This is very helpful analysis. I've added it to my todo list. Could
>> you file a ticket with your test cases, as well? Thanks!
>> http://dev.jquery.com/newticket
>>
>> --John
>>
>>
>>
>> On Mon, Jun 22, 2009 at 4:33 PM, Daniel
>> Friesen<nadir.seen.f...@gmail.com> wrote:
>>
>>> Ok, narrowed it down.
>>> Someone tells me that Konqueror isn't working for that page either so it
>>> looks like IE8 and Konqueror may share this behavior.
>>>  From the looks of it $button.append( "[" ); is working.
>>>
>>> $('#bodyContent').append( "[" ); // works
>>> $('#bodyContent').append( "[", "]" ); // "Invalid argument" in IE8 console, 
>>> works in FF Firebug console
>>> $('#bodyContent').append( "asdf", "asdf" ); // "Invalid argument" in IE8 
>>> console, works in FF Firebug console
>>> $('#bodyContent').append( document.createTextNode("["), "]" ); // works
>>> $('#bodyContent').append( "<span>foo</span>", "]" ); // in IE8 console only 
>>> inserts the ']' the foo span is not inserted, works in FF Firebug console
>>> $('#bodyContent').append( "<span>asdf</span>", "<span>qwerty</span>" ); // 
>>> in IE8 console only inserts the qwerty span the asdf span is not inserted, 
>>> works in FF Firebug console
>>>
>>> So this looks like an IE8 (maybe Konqueror) issue where when .domManip
>>> is used (by something like .append) with more than one argument with the
>>> first being a string a "Invalid argument" error is thrown if the first
>>> argument is not a valid node string. If the first argument is a valid
>>> node string, instead the first argument is ignored and the rest are
>>> inserted.
>>>
>>> ~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://daniel.friesen.name]
>>>
>>> John Resig wrote:
>>>
>>>> You say that you still have problems if you split apart the query.
>>>>
>>>> So in this case $button.append( "[" ) fails - correct?
>>>>
>>>> What happens if you do:
>>>>
>>>> $button.append( document.createTextNode("[") )
>>>>
>>>> --John
>>>>
>>>>
>>>>
>>>> On Mon, Jun 22, 2009 at 2:09 PM, Daniel
>>>> Friesen<nadir.seen.f...@gmail.com> wrote:
>>>>
>>>>
>>>>> I've been having trouble with a bit of jQuery that works in FF, Opera,
>>>>> and Midori, but breaks in IE.
>>>>>
>>>>> See http://animanga.wikia.com/wiki/Sandbox?allinone=0
>>>>> The code: http://dev.wikia.com/wiki/ShowHide/code.js
>>>>> (it's on a wiki, so you can see the history of editing)
>>>>>
>>>>> Using IE8's debugger tools (yay, finally MS rips of Firebug to give us a
>>>>> way to find out why IE is breaking /sarcasm) I've narrowed it down to
>>>>> $button.append( '[', $buttonLink, ']' ); Where jQuery's .append calls
>>>>> .clean which near the end calls fragment.appendChild( ret[i] ); fragment
>>>>> is the document, and i is 0, ret is 3 items in length containing the
>>>>> text node, span, and other text node. jQuery tries to appendChild to the
>>>>> document and IE decides it doesn't like it.
>>>>>
>>>>> Does this seem like a jQuery bug?
>>>>>
>>>>> Note: ya, I have tried splitting the append call into three separate
>>>>> ones, still causes the same issue on the first one.
>>>>>
>>>>> --
>>>>> ~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://daniel.friesen.name]
>>>>>
>>>>>
>>>>>
>>>>>
>>
>> >
>>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-dev@googlegroups.com
To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to