Bug Tracker

Ticket #8007 (closed bug: invalid)

Opened 4 years ago

Last modified 4 years ago

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

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.

Change History

comment:1 Changed 4 years ago by kennyk@…

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 4 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?

 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.

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

comment:3 Changed 4 years ago by jitter

  • Priority changed from undecided to low
  • Resolution set to invalid
  • Status changed from new to closed
  • Component changed from unfiled to selector

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/

Note: See TracTickets for help on using tickets.