aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/jquery/jquery.js10
-rw-r--r--src/selector/selector.js10
2 files changed, 12 insertions, 8 deletions
diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js
index f4d2ef728..38dee9c89 100644
--- a/src/jquery/jquery.js
+++ b/src/jquery/jquery.js
@@ -1100,7 +1100,7 @@ jQuery.fn = jQuery.prototype = {
return this.each(function(){
var obj = this;
- if ( table && this.nodeName.toUpperCase() == "TABLE" && a[0].nodeName.toUpperCase() == "TR" )
+ if ( table && jQuery.nodeName(this, "table") && jQuery.nodeName(a[0], "tr") )
obj = this.getElementsByTagName("tbody")[0] || this.appendChild(document.createElement("tbody"));
jQuery.each( a, function(){
@@ -1229,6 +1229,10 @@ jQuery.extend({
typeof fn[0] == "undefined" && /function/i.test( fn + "" );
},
+ nodeName: function( elem, name ) {
+ return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase();
+ },
+
/**
* A generic iterator function, which can be used to seemlessly
* iterate over both objects and arrays. This function is not the same
@@ -1451,7 +1455,7 @@ jQuery.extend({
tb = div.childNodes;
for ( var n = tb.length-1; n >= 0 ; --n )
- if ( tb[n].nodeName.toUpperCase() == "TBODY" && !tb[n].childNodes.length )
+ if ( jQuery.nodeName(tb[n], "tbody") && !tb[n].childNodes.length )
tb[n].parentNode.removeChild(tb[n]);
}
@@ -1510,7 +1514,7 @@ jQuery.extend({
if ( value != undefined ) elem[fix[name]] = value;
return elem[fix[name]];
- } else if ( value == undefined && jQuery.browser.msie && elem.nodeName && elem.nodeName.toUpperCase() == "FORM" && (name == "action" || name == "method") )
+ } else if ( value == undefined && jQuery.browser.msie && jQuery.nodeName(elem, "form") && (name == "action" || name == "method") )
return elem.getAttributeNode(name).nodeValue;
// IE elem.getAttribute passes even for style
diff --git a/src/selector/selector.js b/src/selector/selector.js
index 6af540ec9..7596acdb9 100644
--- a/src/selector/selector.js
+++ b/src/selector/selector.js
@@ -1,6 +1,6 @@
jQuery.extend({
expr: {
- "": "m[2]=='*'||a.nodeName.toUpperCase()==m[2].toUpperCase()",
+ "": "m[2]=='*'||jQuery.nodeName(a,m[2])",
"#": "a.getAttribute('id')==m[2]",
":": {
// Position Checks
@@ -45,7 +45,7 @@ jQuery.extend({
submit: "a.type=='submit'",
image: "a.type=='image'",
reset: "a.type=='reset'",
- button: 'a.type=="button"||a.nodeName.toUpperCase()=="BUTTON"',
+ button: 'a.type=="button"||jQuery.nodeName(a,"button")',
input: "/input|select|textarea|button/i.test(a.nodeName)"
},
".": "jQuery.className.has(a,m[2])",
@@ -155,7 +155,7 @@ jQuery.extend({
// Perform our own iteration and filter
jQuery.each( ret, function(){
for ( var c = this.firstChild; c; c = c.nextSibling )
- if ( c.nodeType == 1 && ( c.nodeName.toUpperCase() == m[1].toUpperCase() || m[1] == "*" ) )
+ if ( c.nodeType == 1 && ( jQuery.nodeName(c, m[1]) || m[1] == "*" ) )
r.push( c );
});
@@ -227,7 +227,7 @@ jQuery.extend({
// Do a quick check for node name (where applicable) so
// that div#foo searches will be really fast
ret = r = oid &&
- (!m[3] || oid.nodeName.toUpperCase() == m[3].toUpperCase()) ? [oid] : [];
+ (!m[3] || jQuery.nodeName(oid, m[3])) ? [oid] : [];
} else {
// Pre-compile a regular expression to handle class searches
@@ -242,7 +242,7 @@ jQuery.extend({
var tag = m[1] != "" || m[0] == "" ? "*" : m[2];
// Handle IE7 being really dumb about <object>s
- if ( this.nodeName.toUpperCase() == "OBJECT" && tag == "*" )
+ if ( jQuery.nodeName(this, "object") && tag == "*" )
tag = "param";
jQuery.merge( r,