Skip to main content

Bug Tracker

Side navigation

#6566 closed bug (invalid)

Opened May 13, 2010 05:59PM UTC

Closed May 14, 2010 12:38AM UTC

Last modified May 16, 2010 11:02PM UTC

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.

Attachments (0)
Change History (2)

Changed May 14, 2010 12:38AM UTC by dmethvin comment:1

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.

Changed May 16, 2010 11:02PM UTC by cFreed comment:2

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