aboutsummaryrefslogtreecommitdiffstats
path: root/src/attributes.js
diff options
context:
space:
mode:
authortimmywil <timmywillisn@gmail.com>2011-09-12 19:40:14 -0400
committertimmywil <timmywillisn@gmail.com>2011-09-19 15:42:30 -0400
commit92405d4f5ffe9ec1f26f280303783014948438c5 (patch)
treecce9fc8dbb2c13cea02c87a172eb8a0ff0b66440 /src/attributes.js
parent269899a50646e9c1a4f58f1fe91a8a7262fd77e7 (diff)
downloadjquery-92405d4f5ffe9ec1f26f280303783014948438c5.tar.gz
jquery-92405d4f5ffe9ec1f26f280303783014948438c5.zip
Override Sizzle attribute retrieval with jQuery.attr. Fixes #5637, #7128, #9261, #9570, #10178.
Bug fixed on the side: $(window).is('a') was throwing an exception. Fixes #10178.
Diffstat (limited to 'src/attributes.js')
-rw-r--r--src/attributes.js12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/attributes.js b/src/attributes.js
index dd985b494..6380b7d6c 100644
--- a/src/attributes.js
+++ b/src/attributes.js
@@ -7,7 +7,7 @@ var rclass = /[\n\t\r]/g,
rfocusable = /^(?:button|input|object|select|textarea)$/i,
rclickable = /^a(?:rea)?$/i,
rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
- nodeHook, boolHook;
+ nodeHook, boolHook, fixSpecified;
jQuery.fn.extend({
attr: function( name, value ) {
@@ -519,15 +519,19 @@ boolHook = {
// IE6/7 do not support getting/setting some attributes with get/setAttribute
if ( !jQuery.support.getSetAttribute ) {
-
+
+ fixSpecified = {
+ name: true,
+ id: true
+ };
+
// Use this for any attribute in IE6/7
// This fixes almost every IE6/7 issue
nodeHook = jQuery.valHooks.button = {
get: function( elem, name ) {
var ret;
ret = elem.getAttributeNode( name );
- // Return undefined if nodeValue is empty string
- return ret && ret.nodeValue !== "" ?
+ return ret && (fixSpecified[ name ] ? ret.nodeValue !== "" : ret.specified) ?
ret.nodeValue :
undefined;
},