Skip to main content

Bug Tracker

Side navigation

#8007 closed bug (invalid)

Opened January 19, 2011 08:25AM UTC

Closed January 20, 2011 12:29AM UTC

Selector "input[type='text']" does not work with native <input/> field

Reported by: anonymous Owned by:
Priority: low Milestone: 1.next
Component: selector Version: 1.4.4
Keywords: Cc:
Blocked by: Blocking:
Description

Binding does not work with native <input>, which should have type='text'.

Only explicitly declared <input type='text'> are responded.

See example below:

http://jsfiddle.net/2Jbw9/5/

type is 'text' but it doesn't get fired.

Note: Tried with delegate, also have this problem.

Note1: It seems working before, when in jQuery 1.4.2.

Attachments (0)
Change History (3)

Changed January 19, 2011 08:28AM UTC by kennyk@peplink.com comment:1

Double confirmed that jQuery 1.4.2 should be working fine, with my production code calling 'delegate' (fiddle doesn't allow sample for this version)

Our code breaks and hit this bug when loaded with jQuery 1.4.4.

Changed January 19, 2011 04:08PM UTC by danheberden comment:2

_comment0: Thanks for making the bug report. Although some work in how jquery and sizzle is planned for how element attrs are used, I can't say the functionality you're hitting is unreasonable. Why? \ \ http://jsfiddle.net/danheberden/2Jbw9/6/ \ \ Notice how the CSS selector - the raw implementation of that selector only selects one of the items. Plus, the [type="whatever"] is an attribute selector. While the browser will, by default, make it a text input - that attribute is not present. 1295454761185514

Thanks for making the bug report. Although some work in how jquery and sizzle is planned for how element attrs are used, I can't say the functionality you're hitting is unreasonable. Why?

http://jsfiddle.net/danheberden/2Jbw9/6/

Notice how the CSS selector - the raw implementation of that selector - only selects one of the items. Plus, the [type="whatever"] is an attribute selector. While the browser will, by default, make it a text input - that attribute is not present.

Changed January 20, 2011 12:29AM UTC by jitter comment:3

component: unfiledselector
priority: undecidedlow
resolution: → invalid
status: newclosed

danheberden is right about this. If you omit the type attribute the input defaults to Text state. Which means it acts as if you had set type="text".

But that doesn't mean that it magically has the type attribute set to text.

Thus input[type="text"] matches the right thing be it in jQuery be it the native CSS3 selector in the browser.

http://jsfiddle.net/jitter/HApEf/