https://bugzilla.wikimedia.org/show_bug.cgi?id=28413

--- Comment #4 from Krinkle <[email protected]> 2011-04-06 16:46:20 UTC ---
(In reply to comment #3)
> Well, mediaWiki.loader.load uses..
> 
> $( 'head' ).append( $( '<link rel="stylesheet" type="text/css" />' ).attr(
> 'href', modules ) );
> 
> So, are we saying that using some of the attributes in the initial HTML string
> is the difference between IE crashing or not?

Well, not by definition. The difference is that this:

$( '<link />' )

Will cause jQuery's quick regex to pick it up and use document.createElement,
whereas anything more complicated makes it append it to a <div> and get the
inner child(ren).

http://api.jquery.com/jQuery#jQuery2 states:

* "When the HTML is more complex than a single tag without attributes [..] the
actual creation of the elements is handled by the browser's innerHTML
mechanism. In most cases, jQuery creates a new <div> element and sets the
innerHTML property of the element to the HTML snippet that was passed in. "
* "When passing in complex HTML, some browsers may not generate a DOM that
exactly replicates the HTML source provided."
* "To ensure cross-platform compatibility, the snippet must be well-formed."

This was also the cause of a few bugs in the makeCollapsible plugin which used
"<span></a></span>" to quickly create a wrapped anchor tag (works fine in
WebKit-browsers), but goes bad in (some) IE versions.

I think Internet Explorer wants link-tags to be closed instead of self-closing.
Either way, the solution is by using the native createElement function.

In other words (as, in a way, Trevor already said): "[attributes] in the
initial HTML string is the difference between IE crashing or not". Yes :-D

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to