Skip to main content

Bug Tracker

Side navigation

#11194 closed bug (invalid)

Opened January 19, 2012 01:54PM UTC

Closed January 19, 2012 01:57PM UTC

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

Attachments (0)
Change History (1)

Changed January 19, 2012 01:57PM UTC by dmethvin comment:1

resolution: → invalid
status: newclosed

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