Bug Tracker

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#12581 closed bug (notabug)

IE8 append to must have a closing tag

Reported by: theallan Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.8.1
Keywords: Cc:
Blocked by: Blocking:


Its very handy to be able to create HTML tags with the jQuery 'selector' but, it seems that IE8 requires the closing tag is some circumstances and not others (specifically it is needed when passed into append, but not the main selector)

$('#one').append('<span>'); Its this one which is not being inserted $('#one').append('<span></span>');

$('<span>').appendTo('#three'); $('<span></span>').appendTo('#four');


Its obviously easy to close the tag off, but I'd have expected the interface for the two method used here to have the same outcome.

Change History (4)

comment:1 Changed 10 years ago by dmethvin

Resolution: notabug
Status: newclosed

Not only is it easy, but it makes the HTML correct. I think that's the problem with trying to correct bad input. Once we do it one place, people expect it to be corrected everywhere. We corrected $("<simpletag >") because it could be done cheaply, but I don't think we want to attempt an W3C HTML Validator for all input HTML arguments in jQuery.

comment:2 Changed 10 years ago by theallan

The documentation says:

The .append() and .appendTo() methods perform the same task

However, they apparently don't perform the same task. I agree that it should probably always just require valid input, but the difference between the two methods is what caught me off guard. Can they not be harmonised?

comment:3 Changed 10 years ago by dmethvin

Well they perform the same task for valid inputs. What they do with invalid inputs may differ.

comment:4 Changed 10 years ago by theallan

:-). Fair enough! Thanks for the feedback.

Note: See TracTickets for help on using tickets.