diff --git a/CHANGELOG b/CHANGELOG index 0a0be69b5..b080799ed 100644 --- a/CHANGELOG +++ b/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) diff --git a/src/dom/form.js b/src/dom/form.js index d2dfdd729..c521d05a8 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); }); }, @@ -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;