Bug Tracker

Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#6566 closed bug (invalid)

Create a DOM element with $("<input />") adds unexpected content

Reported by: cFreed Owned by:
Priority: Milestone: 1.4.3
Component: core Version: 1.4.2
Keywords: createDOMElement HTML Cc:
Blocked by: Blocking:

Description

The $("<tag />") statement creates a normal DOM element like <tag></tag> for any tag value.

The $("<tag />").html("") statement should produce exactly the same. But in fact, when tag is INPUT I get (with jQuery 1.4.2) the following DOM element:

<input><input xmlns="http://www.w3.org/1999/xhtml"></input>

It may be easily controlled in the console, using:

$("<tag />").html("").html()

which returns an empty string for any tag value, except INPUT.

Change History (2)

comment:1 Changed 13 years ago by dmethvin

Resolution: invalid
Status: newclosed

It's not valid to try appending *anything* to a tag that cannot other elements, such as <input> or <br>. Since it's an error condition, the browser may not give the results you expect.

comment:2 Changed 13 years ago by cFreed

Sorry for the noise: sure it's obvious as soon as pointed!

Note: See TracTickets for help on using tickets.