Bug Tracker

Opened 12 years ago

Closed 12 years ago

#8007 closed bug (invalid)

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:


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.

Change History (3)

comment:1 Changed 12 years ago by [email protected]

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.

comment:2 Changed 12 years ago by danheberden

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?


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.

Last edited 12 years ago by danheberden (previous) (diff)

comment:3 Changed 12 years ago by jitter

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.


Note: See TracTickets for help on using tickets.