diff --git a/CHANGELOG b/CHANGELOG index 19f5069..03fa21a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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) diff --git a/src/dom/form.js b/src/dom/form.js index 274969a..a07f07d 100644 --- a/src/dom/form.js +++ b/src/dom/form.js @@ -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;