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 committed May 30, 2009
1 parent 2c1923c commit efb69c9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG
@@ -1,3 +1,5 @@
* Replace array creation and `Array#include` with a more efficient `RegExp#test`. (kangax)

* Make sure BUTTON elements are included in form serialization. (Luis Gomez, freshteapot, Samuel Lebeau, kangax)

* Make sure (defficient) APPLET, OBJECT and EMBED elements are extended with simulated methods in IE8. Return early if _extendedByPrototype is present on an element. (Tobie Langel, kangax)
Expand Down
4 changes: 2 additions & 2 deletions src/dom/form.js
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 @@ -333,7 +333,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

1 comment on commit efb69c9

@savetheclocktower
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Committed.

Please sign in to comment.