[jQuery] Does append() work with application/xhtml+xml doc types?

[jQuery] Does append() work with application/xhtml+xml doc types?


Hi All,
I'm not able to get append() to work with this kind of doc type.
For example, in a XHTML 1.0 strict document, the following piece of
Javascript code works:
var ns = "http://www.w3.org/1999/xhtml";
var d0=document.createElementNS(ns,"div");
d0.setAttribute("id","mytest");
d0.setAttribute("style", "width:50px;left:50px;top:
50px;position:absolute;");
txt0 = document.createTextNode('MyTest');
d0.appendChild(txt0);
$('body').append(d0);
while the following jQuery code does not:
$('body').append('<div id="mytest" style="width:50px;left:50px;top:
50px;position:absolute">MyTest</div>');
whenever I try to reveal the created <div>:
$('#mytest').show(); // or
$('div[@id=mytest]').show();
it fails with the second code snippet, while it works with the first
code snippet.
It seems that the jQuery code does not create a valid <div>, as I'm
unable to make it appear, nor I'm able to select it
(document.getElementById('mytest') returns null)
Is this a known limitation of jQuery - I tried w/ several modern
browsers w/ no luck -, and/or is there a workaround?
Thanks in advance,
Manu