Skip to content
Permalink
Browse files

Standardize on using .nodeName in place of .tagName. Fixes jQuery bug…

… #4923.
  • Loading branch information
jeresig committed Jul 19, 2009
1 parent 0d5c3a6 commit 48e9a3999596c2ee1f4470a78637de8f27e3b219
Showing with 12 additions and 12 deletions.
  1. +1 −1 src/ajax.js
  2. +2 −2 src/attributes.js
  3. +5 −5 src/fx.js
  4. +3 −3 src/offset.js
  5. +1 −1 src/selector.js
@@ -481,7 +481,7 @@ jQuery.extend({
xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0,
data = xml ? xhr.responseXML : xhr.responseText;

if ( xml && data.documentElement.tagName == "parsererror" ) {
if ( xml && data.documentElement.nodeName == "parsererror" ) {
throw "parsererror";
}

@@ -192,15 +192,15 @@ jQuery.extend({
if (!elem || elem.nodeType == 3 || elem.nodeType == 8)
return undefined;

var notxml = !elem.tagName || !jQuery.isXMLDoc( elem ),
var notxml = elem.nodeType !== 1 || !jQuery.isXMLDoc( elem ),
// Whether we are setting (or getting)
set = value !== undefined;

// Try to normalize/fix the name
name = notxml && jQuery.props[ name ] || name;

// Only do all the following if this is a node (faster for style)
if ( elem.tagName ) {
if ( elem.nodeType === 1 ) {

// These attributes require special treatment
var special = /href|src|style/.test( name );
@@ -28,20 +28,20 @@ jQuery.fn.extend({
this[i].style.display = old || "";

if ( jQuery.css(this[i], "display") === "none" ) {
var tagName = this[i].tagName, display;
var nodeName = this[i].nodeName, display;

if ( elemdisplay[ tagName ] ) {
display = elemdisplay[ tagName ];
if ( elemdisplay[ nodeName ] ) {
display = elemdisplay[ nodeName ];
} else {
var elem = jQuery("<" + tagName + " />").appendTo("body");
var elem = jQuery("<" + nodeName + " />").appendTo("body");

display = elem.css("display");
if ( display === "none" )
display = "block";

elem.remove();

elemdisplay[ tagName ] = display;
elemdisplay[ nodeName ] = display;
}

jQuery.data(this[i], "olddisplay", display);
@@ -39,7 +39,7 @@ if ( "getBoundingClientRect" in document.documentElement ) {
top += elem.offsetTop;
left += elem.offsetLeft;

if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && /^t(able|d|h)$/i.test(elem.tagName)) ) {
if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && /^t(able|d|h)$/i.test(elem.nodeName)) ) {
top += parseFloat( computedStyle.borderTopWidth ) || 0;
left += parseFloat( computedStyle.borderLeftWidth ) || 0;
}
@@ -127,7 +127,7 @@ jQuery.fn.extend({

// Get correct offsets
offset = this.offset(),
parentOffset = /^body|html$/i.test(offsetParent[0].tagName) ? { top: 0, left: 0 } : offsetParent.offset();
parentOffset = /^body|html$/i.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset();

// Subtract element margins
// note: when an element has margin: auto the offsetLeft and marginLeft
@@ -149,7 +149,7 @@ jQuery.fn.extend({
offsetParent: function() {
return this.map(function(){
var offsetParent = this.offsetParent || document.body;
while ( offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && jQuery.css(offsetParent, 'position') === 'static') ) {
while ( offsetParent && (!/^body|html$/i.test(offsetParent.nodeName) && jQuery.css(offsetParent, 'position') === 'static') ) {
offsetParent = offsetParent.offsetParent;
}
return offsetParent;
@@ -978,7 +978,7 @@ jQuery.expr[":"] = jQuery.expr.filters;

Sizzle.selectors.filters.hidden = function(elem){
var width = elem.offsetWidth, height = elem.offsetHeight,
force = /^tr$/i.test( elem.tagName ); // ticket #4512
force = /^tr$/i.test( elem.nodeName ); // ticket #4512
return ( width === 0 && height === 0 && !force ) ?
true :
( width !== 0 && height !== 0 && !force ) ?

0 comments on commit 48e9a39

Please sign in to comment.
You can’t perform that action at this time.