Replace array creation and Array#include
with a more efficient RegExp#test
This commit is contained in:
parent
7d02aef6ca
commit
703e988745
@ -1,3 +1,5 @@
|
||||
* Replace array creation and `Array#include` with a more efficient `RegExp#test`. (kangax)
|
||||
|
||||
* Reorganize the way `ElementExtensions` are defined. Make sure elements used in SpecificElementExtensions are cleaned up. (kangax)
|
||||
|
||||
* Make sure $A works with primitive values. (mr_justin, kangax)
|
||||
|
@ -163,7 +163,7 @@ Form.Methods = {
|
||||
}).sortBy(function(element) { return element.tabIndex }).first();
|
||||
|
||||
return firstByIndex ? firstByIndex : elements.find(function(element) {
|
||||
return ['input', 'select', 'textarea'].include(element.tagName.toLowerCase());
|
||||
return /^(?:input|select|textarea)$/i.test(element.tagName);
|
||||
});
|
||||
},
|
||||
|
||||
@ -332,7 +332,7 @@ Form.Element.Methods = {
|
||||
try {
|
||||
element.focus();
|
||||
if (element.select && (element.tagName.toLowerCase() != 'input' ||
|
||||
!['button', 'reset', 'submit'].include(element.type)))
|
||||
!(/^(?:button|reset|submit)$/i.test(element.type))))
|
||||
element.select();
|
||||
} catch (e) { }
|
||||
return element;
|
||||
|
Loading…
Reference in New Issue
Block a user