jQuery.clean method) when you pass a string to append/prepend/etc. But
it is skipped if the argument is a HTMLElement, fragment or jQ object.
This should work in "real" XHTML too:
$('body').append( $('<p/>').text('hello') );
On Jul 29, 1:56 pm, ScottSEA <william.scott.ba...@gmail.com> wrote:
> I have a full explanation of my issue on StackOverflow.com - if you're
> interested in the code, please refer here:
>
> http://stackoverflow.com/questions/1190763/firefox-not-running-jquery...
>
> It is marked as answered, but ignore that.
>
> The gist of the problem is when I load a *local* .xml file (in
> firefox) the document transforms to XHTML, but the jQuery .append
> ('<p>Ipsum Lorem</p>') (as well as prepend, prependTo, appendTo,
> remove, etc) method silently fails to do anything. HOWEVER, if I
> construct the node to append in this manner:
>
> var frag = document.createDocumentFragment();
> var p = document.createElement('p');
> p.appendChild(document.createTextNode('Ipsum Lorem'));
> frag.appendChild(p);
> $('body').append(frag);
>
> It works fine. Can anyone tell me why?
>
> If I change my stylesheet to <output method="html" ... /> vs.
> method="xml" the jQuery code starts working again - but I am
> irrevocably tied to XHTML.
No comments:
Post a Comment