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: {
|
valHooks: {
|
||||||
option: {
|
option: {
|
||||||
get: function( elem ) {
|
get: function( elem ) {
|
||||||
// attributes.value is undefined in Blackberry 4.7 but
|
// Use proper attribute retrieval(#6932, #12072)
|
||||||
// uses .value. See #6932
|
var val = jQuery.find.attr( elem, "value" );
|
||||||
var val = elem.attributes.value;
|
return val != null ?
|
||||||
return !val || val.specified ? elem.value : elem.text;
|
val :
|
||||||
|
elem.text;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
select: {
|
select: {
|
||||||
@ -430,10 +431,11 @@ jQuery.extend({
|
|||||||
get: function( elem ) {
|
get: function( elem ) {
|
||||||
// elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
|
// 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/
|
// 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 ?
|
return tabindex ?
|
||||||
parseInt( attributeNode.value, 10 ) :
|
parseInt( tabindex, 10 ) :
|
||||||
rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
|
rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
|
||||||
0 :
|
0 :
|
||||||
-1;
|
-1;
|
||||||
@ -489,13 +491,12 @@ jQuery.each( jQuery.expr.match.boolean.source.match( /\w+/g ), function( i, name
|
|||||||
// fix oldIE attroperties
|
// fix oldIE attroperties
|
||||||
if ( !getSetInput || !getSetAttribute ) {
|
if ( !getSetInput || !getSetAttribute ) {
|
||||||
jQuery.expr.attrHandle.value = function( elem, name, isXML ) {
|
jQuery.expr.attrHandle.value = function( elem, name, isXML ) {
|
||||||
var ret = elem.getAttributeNode( name );
|
var ret;
|
||||||
return isXML ? undefined : jQuery.nodeName( elem, "input" ) ?
|
return isXML ? undefined :
|
||||||
|
// Ignore the value *property* on inputs by using defaultValue
|
||||||
// Ignore the value *property* by using defaultValue
|
jQuery.nodeName( elem, "input" ) ? elem.defaultValue :
|
||||||
elem.defaultValue :
|
// Retrieve the attribute
|
||||||
|
(ret = elem.getAttributeNode( name )) && ret.specified ? ret.value : undefined;
|
||||||
ret && ret.specified ? ret.value : undefined;
|
|
||||||
};
|
};
|
||||||
jQuery.attrHooks.value = {
|
jQuery.attrHooks.value = {
|
||||||
set: function( elem, value, name ) {
|
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
|
// Replace/restore the type attribute of script elements for safe DOM manipulation
|
||||||
function disableScript( elem ) {
|
function disableScript( elem ) {
|
||||||
var attr = elem.getAttributeNode("type");
|
elem.type = !!jQuery.find.attr( elem, "type" ) + "/" + elem.type;
|
||||||
elem.type = ( attr && attr.specified ) + "/" + elem.type;
|
|
||||||
return elem;
|
return elem;
|
||||||
}
|
}
|
||||||
function restoreScript( elem ) {
|
function restoreScript( elem ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user