Skip to main content

Bug Tracker

Side navigation

#1891 closed bug (worksforme)

Opened November 05, 2007 01:49PM UTC

Closed November 17, 2007 05:37AM UTC

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!

Attachments (0)
Change History (1)

Changed November 17, 2007 05:37AM UTC by davidserduke comment:1

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.