First proposed solution for IE6/7 get/setAttribute quirks. Needs more testing, but solves some issues
This commit is contained in:
parent
607210e010
commit
4baa213d88
|
@ -275,12 +275,6 @@ jQuery.extend({
|
||||||
offset: true
|
offset: true
|
||||||
},
|
},
|
||||||
|
|
||||||
// TODO: Check to see if any of these are needed anymore?
|
|
||||||
// If not, it may be good to standardize on all-lowercase names instead
|
|
||||||
attrFix: {
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
attr: function( elem, name, value, pass ) {
|
attr: function( elem, name, value, pass ) {
|
||||||
|
|
||||||
// don't get/set attributes on text, comment and attribute nodes
|
// don't get/set attributes on text, comment and attribute nodes
|
||||||
|
@ -342,7 +336,7 @@ jQuery.extend({
|
||||||
// Look for the name in elem.attributes.name
|
// Look for the name in elem.attributes.name
|
||||||
var attrs = elem.attributes, i = 0, len = attrs.length;
|
var attrs = elem.attributes, i = 0, len = attrs.length;
|
||||||
for ( ; i < len; i++ ) {
|
for ( ; i < len; i++ ) {
|
||||||
if ( attrs[i]["name"] === name ) {
|
if ( attrs[i].name === name ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -475,4 +469,31 @@ if ( !jQuery.support.optSelected ) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
})( jQuery );
|
// IE6/7 do not support getting/setting some attributes with get/setAttribute
|
||||||
|
|
||||||
|
if ( jQuery.support.attrFix ) {
|
||||||
|
var attrFix = {
|
||||||
|
"for": "htmlFor",
|
||||||
|
"class": "className",
|
||||||
|
readonly: "readOnly",
|
||||||
|
maxlength: "maxLength",
|
||||||
|
cellspacing: "cellSpacing",
|
||||||
|
rowspan: "rowSpan",
|
||||||
|
colspan: "colSpan",
|
||||||
|
tabindex: "tabIndex",
|
||||||
|
usemap: "useMap",
|
||||||
|
frameborder: "frameBorder"
|
||||||
|
};
|
||||||
|
|
||||||
|
jQuery.each(attrFix, function( key, name ) {
|
||||||
|
jQuery.attrHooks[ key ] = jQuery.extend( jQuery.attrHooks[ key ], {
|
||||||
|
get: function( elem ) {
|
||||||
|
return elem.getAttribute( name );
|
||||||
|
},
|
||||||
|
set: function( elem, value ) {
|
||||||
|
elem.setAttribute( name, value );
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
|
@ -7,6 +7,7 @@
|
||||||
var div = document.createElement("div");
|
var div = document.createElement("div");
|
||||||
|
|
||||||
div.style.display = "none";
|
div.style.display = "none";
|
||||||
|
div.setAttribute("className", "t");
|
||||||
div.innerHTML = " <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
|
div.innerHTML = " <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
|
||||||
|
|
||||||
var all = div.getElementsByTagName("*"),
|
var all = div.getElementsByTagName("*"),
|
||||||
|
@ -58,6 +59,8 @@
|
||||||
// (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
|
// (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
|
||||||
optSelected: opt.selected,
|
optSelected: opt.selected,
|
||||||
|
|
||||||
|
attrFix: div.getAttribute("className") === "t",
|
||||||
|
|
||||||
// Will be defined later
|
// Will be defined later
|
||||||
deleteExpando: true,
|
deleteExpando: true,
|
||||||
optDisabled: false,
|
optDisabled: false,
|
||||||
|
|
Loading…
Reference in a new issue