Skip to content

Commit

Permalink
Replace array creation and Array#include with a more efficient `Reg…
Browse files Browse the repository at this point in the history
…Exp#test`
  • Loading branch information
Juriy Zaytsev authored and savetheclocktower committed Jun 5, 2009
1 parent 7d02aef commit 703e988
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/dom/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
},

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 703e988

Please sign in to comment.