Bug Tracker

Modify

Ticket #1891 (closed bug: worksforme)

Opened 6 years ago

Last modified 6 years ago

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:
Blocking: Blocked by:

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

comment:1 Changed 6 years ago by davidserduke

  • Status changed from new to closed
  • Resolution set to worksforme

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.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.