Not consistent, but:

Yes: is text case sensitive?

Is jQuery case sensitive: case sensitive?

Example:

<input type="TEXT"> 

Not consistent, but:

 <input type="TEXT"> 

It matches.

This is apparently the case. I'm just looking for confirmation.

EDIT

It seems that even the [type = text] selector is case sensitive in Chrome and Firefox, but not IE8 (in IE8 document mode)

+6
source share
3 answers

Edit : Despite my research, I first made a completely wrong conclusion. The answer was updated: O (kudo go to @ThiagoSantos, which had the correct answer from the beginning: D).

jQuery ": text" documentation says:

Because: text is a jQuery extension, not part of the CSS specification, queries using: text cannot take advantage of the performance improvements provided by the DOM querySelectorAll () built-in method.

If you dive into source 1.7.1 , it seems that this selector is implemented as:

 text: function( elem ) { var attr = elem.getAttribute( "type" ), type = elem.type; // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) // use getAttribute instead to test this case return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null ); } 

For <input type="tEXt" /> the attr value is "tEXt", which will not match type . To my own surprise, then:

The updated answer should be :: the text is case sensitive

+4
source

These seem to be sensitive guys. Thus, in reality, the following is not true.

$ (': text') is equivalent to $ ('[type = text]')

Here is an example .. just one warning for this

http://jsfiddle.net/huX3M/

+3
source

I would say, firstly, yes, it is case sensitive. See this jsFiddle .

Given that <input type="text"> should behave exactly like <input type="text"> , I think this is probably a mistake.

In any case, it is better to use [type="text"] , as this can be analyzed using querySelectorAll and, therefore, will have significant performance advantages.

+2
source

Source: https://habr.com/ru/post/903634/


All Articles