Modify ↓
Ticket #11194 (closed bug: invalid)
Passing a HTML tag with attributes to jQuery without a closing tag (either /> or </tag>) has different behaviour in IE 8
| Reported by: | oheard | Owned by: | |
|---|---|---|---|
| Priority: | undecided | Milestone: | None |
| Component: | unfiled | Version: | 1.7.1 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
When creating a new HTML element with attributes by passing the source to the jQuery constructor, if no closing tag is present most browsers create the element anyway.
IE 8 (and maybe below, I don't have < 8) return an empty jQuery object.
Example without attributes, showing the expected behavour: http://jsfiddle.net/HJyGz/0/
Example with an attribute, showing the buggy behaviour: http://jsfiddle.net/HJyGz/1/
Change History
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.

Yes, as clearly documented. If it needs a closing tag you should provide one. Just like script tags need a closing tag and can't be shortcutted.
http://api.jquery.com/jQuery/#jQuery2