]> source.dussan.org Git - jquery.git/commitdiff
Make sure that expando properties aren't set on embed, applet, or object elements...
authorJohn Resig <jeresig@gmail.com>
Mon, 7 Dec 2009 04:00:31 +0000 (20:00 -0800)
committerJohn Resig <jeresig@gmail.com>
Mon, 7 Dec 2009 04:00:31 +0000 (20:00 -0800)
src/data.js
src/manipulation.js

index 1d993fe5827cac1c79a004815b7925bc1426c342..44d77a902634d10336b212d145dc3e339e2bf07a 100644 (file)
@@ -6,7 +6,19 @@ jQuery.extend({
        
        expando:expando,
 
+       // The following elements throw uncatchable exceptions if you
+       // attempt to add expando properties to them.
+       noData: {
+               "embed": true,
+               "object": true,
+               "applet": true
+       },
+
        data: function( elem, name, data ) {
+               if ( jQuery.noData[elem.nodeNode.toLowerCase()] ) {
+                       return;
+               }
+
                elem = elem == window ?
                        windowData :
                        elem;
@@ -43,6 +55,10 @@ jQuery.extend({
        },
 
        removeData: function( elem, name ) {
+               if ( jQuery.noData[elem.nodeNode.toLowerCase()] ) {
+                       return;
+               }
+
                elem = elem == window ?
                        windowData :
                        elem;
index a8cb484bbd8e667e338d47fc37c5a45dd36931c3..e1657a8cf58b65ea9f4e02b7f6e16e41f56be355 100644 (file)
@@ -463,7 +463,7 @@ jQuery.extend({
 
 function cleanData( elems ) {
        for ( var i = 0, elem, id; (elem = elems[i]) != null; i++ ) {
-               if ( (id = elem[expando]) ) {
+               if ( !jQuery.noData[elem.nodeNode.toLowerCase()] && (id = elem[expando]) ) {
                        delete jQuery.cache[ id ];
                }
        }