mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Remove usage of the deprecated getAttributeNode() unless a support test warrants it. Fixes #12072.
This commit is contained in:
parent
35784a8244
commit
ed66609a70
@ -229,10 +229,11 @@ jQuery.extend({
|
||||
valHooks: {
|
||||
option: {
|
||||
get: function( elem ) {
|
||||
// attributes.value is undefined in Blackberry 4.7 but
|
||||
// uses .value. See #6932
|
||||
var val = elem.attributes.value;
|
||||
return !val || val.specified ? elem.value : elem.text;
|
||||
// Use proper attribute retrieval(#6932, #12072)
|
||||
var val = jQuery.find.attr( elem, "value" );
|
||||
return val != null ?
|
||||
val :
|
||||
elem.text;
|
||||
}
|
||||
},
|
||||
select: {
|
||||
@ -430,10 +431,11 @@ jQuery.extend({
|
||||
get: function( elem ) {
|
||||
// elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
|
||||
// http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
|
||||
var attributeNode = elem.getAttributeNode("tabindex");
|
||||
// Use proper attribute retrieval(#12072)
|
||||
var tabindex = jQuery.find.attr( elem, "tabindex" );
|
||||
|
||||
return attributeNode && attributeNode.specified ?
|
||||
parseInt( attributeNode.value, 10 ) :
|
||||
return tabindex ?
|
||||
parseInt( tabindex, 10 ) :
|
||||
rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
|
||||
0 :
|
||||
-1;
|
||||
@ -489,13 +491,12 @@ jQuery.each( jQuery.expr.match.boolean.source.match( /\w+/g ), function( i, name
|
||||
// fix oldIE attroperties
|
||||
if ( !getSetInput || !getSetAttribute ) {
|
||||
jQuery.expr.attrHandle.value = function( elem, name, isXML ) {
|
||||
var ret = elem.getAttributeNode( name );
|
||||
return isXML ? undefined : jQuery.nodeName( elem, "input" ) ?
|
||||
|
||||
// Ignore the value *property* by using defaultValue
|
||||
elem.defaultValue :
|
||||
|
||||
ret && ret.specified ? ret.value : undefined;
|
||||
var ret;
|
||||
return isXML ? undefined :
|
||||
// Ignore the value *property* on inputs by using defaultValue
|
||||
jQuery.nodeName( elem, "input" ) ? elem.defaultValue :
|
||||
// Retrieve the attribute
|
||||
(ret = elem.getAttributeNode( name )) && ret.specified ? ret.value : undefined;
|
||||
};
|
||||
jQuery.attrHooks.value = {
|
||||
set: function( elem, value, name ) {
|
||||
|
@ -319,8 +319,7 @@ function manipulationTarget( elem, content ) {
|
||||
|
||||
// Replace/restore the type attribute of script elements for safe DOM manipulation
|
||||
function disableScript( elem ) {
|
||||
var attr = elem.getAttributeNode("type");
|
||||
elem.type = ( attr && attr.specified ) + "/" + elem.type;
|
||||
elem.type = !!jQuery.find.attr( elem, "type" ) + "/" + elem.type;
|
||||
return elem;
|
||||
}
|
||||
function restoreScript( elem ) {
|
||||
|
Loading…
Reference in New Issue
Block a user