jQuery: The Write Less, Do More JavaScript Library

Ticket #1407 (new bug)

Opened 1 year ago

Last modified 9 months ago

I got a bug about method append()/appendTo()

Reported by: AvengerBevis Assigned to: anonymous
Type: bug Priority: critical
Milestone: 1.1.4 Component: build
Version: 1.1.3 Keywords:
Cc: Needs: Review

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...

Attachments

Change History

Changed 1 year ago by AvengerBevis

I find why it does not work $('<son></son>').length is 0

Why $('<div></div>').length is 1 but <son> is 0?

Note: See TracTickets for help on using tickets.