Standardizing on .test() and .exec() - moving away from using .match() for RegExp. Fixes jQuery bug #4113.

This commit is contained in:
John Resig 2009-07-19 13:21:51 +00:00
parent a3b8ac413f
commit 0d5c3a68a0
7 changed files with 20 additions and 20 deletions

View file

@ -214,7 +214,7 @@ jQuery.extend({
if ( name in elem && notxml && !special ) {
if ( set ){
// We can't allow the type property to be changed (since it causes problems in IE)
if ( name == "type" && elem.nodeName.match(/(button|input)/i) && elem.parentNode )
if ( name == "type" && /(button|input)/i.test(elem.nodeName) && elem.parentNode )
throw "type property can't be changed";
elem[ name ] = value;
@ -230,9 +230,9 @@ jQuery.extend({
var attributeNode = elem.getAttributeNode( "tabIndex" );
return attributeNode && attributeNode.specified
? attributeNode.value
: elem.nodeName.match(/(button|input|object|select|textarea)/i)
: /(button|input|object|select|textarea)/i.test(elem.nodeName)
? 0
: elem.nodeName.match(/^(a|area)$/i) && elem.href
: /^(a|area)$/i.test(elem.nodeName) && elem.href
? 0
: undefined;
}