Side navigation
#1407 closed bug (invalid)
Opened July 19, 2007 06:56AM UTC
Closed January 07, 2009 03:32AM UTC
I got a bug about method append()/appendTo()
| Reported by: | AvengerBevis | Owned by: | |
|---|---|---|---|
| Priority: | critical | Milestone: | 1.1.4 |
| Component: | build | Version: | 1.1.3 |
| Keywords: | Cc: | ||
| Blocked by: | Blocking: |
Description
This is code :
<script src="jquery.js"></script>
<script>
function domToString(dom){
if(!dom) return "";
if($.browser.msie)
return dom.xml;
return (new XMLSerializer()).serializeToString(dom);
}
function stringToDOM(xmlString){
if(!xmlString || typeof xmlString != 'string') return null;
var xmlDom;
if($.browser.msie){//IE{
xmlDom = new ActiveXObject("Microsoft.XMLDOM");
xmlDom.loadXML(xmlString);
}else if(DOMParser) { //Mozillia Gecko
xmlDom = new DOMParser().parseFromString(xmlString,'text/xml');
} // end if
return xmlDom;
}
var dom = stringToDOM('<?xml version="1.0" encoding="UTF-8"?><root></root>')
$('<son></son>').appendTo($(dom).find('root'));
alert(domToString(dom))
</script>
Please save it as htm(l) and run it in MSIE and Firefox
I got defferent results : MSIE can not append the node to DOM but firefox can
My project was worried about this bug
If you got a solution , please email me and tell me how can i do.
I'm waiting...
I find why it does not work
$('<son></son>').length is 0
Why $('<div></div>').length is 1 but <son> is 0?