Standardize on using .nodeName in place of .tagName. Fixes jQuery bug #4923.
This commit is contained in:
parent
0d5c3a68a0
commit
48e9a39995
|
@ -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,7 +192,7 @@ 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;
|
||||
|
||||
|
@ -200,7 +200,7 @@ jQuery.extend({
|
|||
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 );
|
||||
|
|
10
src/fx.js
10
src/fx.js
|
@ -28,12 +28,12 @@ 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" )
|
||||
|
@ -41,7 +41,7 @@ jQuery.fn.extend({
|
|||
|
||||
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 ) ?
|
||||
|
|
Loading…
Reference in a new issue