Bug Tracker

Opened 15 years ago

Closed 15 years ago

#1891 closed bug (worksforme)

DOM creation in IE broken

Reported by: george.petrov Owned by:
Priority: major Milestone: 1.2.2
Component: core Version: 1.2.1
Keywords: Cc:
Blocked by: Blocking:

Description

Seems that with the latest 1.2.1 some basic DOM creation like this:

	var hImgCon = $('#d1');
	var el = $('<span>');
	el.appendTo( hImgCon );		
	alert(hImgCon.html());

is broken in IE6 and 7 - alerts empty string. While in FF is working all fine.

This was working fine with previous jQuery versions.

only creating $('<div>') works fine - other elements created by $(' <xxx>') do not come in IE.

Maybe this has to do something with closing tags? Because using $('<span />') seems to work fine!

Change History (1)

comment:1 Changed 15 years ago by davidserduke

Resolution: worksforme
Status: newclosed

It looks like this was caused by an inability of IE to serialize some tags. The workaround for IE was to wrap the html in a div and set it to innerHTML. Apparently IE doesn't like it now without a closing tag. The resulting innerHTML looks like <div><span></div></span> which causes the problem. That is probably why div works. It ends up looking like <div><div></div></div> which is fine.

I went ahead an updated the documentation here:

http://docs.jquery.com/Core/jQuery#html

to explain better what works.

For more detail check here:

http://dev.jquery.com/ticket/1587

So I'm going to close this one also.

Note: See TracTickets for help on using tickets.