Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Make sure that expando properties aren't set on embed, applet, or obj…

…ect elements. An uncatchable exception is thrown and we must avoid it. Fixes #1675 and #2349.
  • Loading branch information...
commit 59802928566b6be3a66d65e77c2418fff37e6f5f 1 parent 7d36ccf
John Resig authored December 06, 2009
16  src/data.js
@@ -6,7 +6,19 @@ jQuery.extend({
6 6
 	
7 7
 	expando:expando,
8 8
 
  9
+	// The following elements throw uncatchable exceptions if you
  10
+	// attempt to add expando properties to them.
  11
+	noData: {
  12
+		"embed": true,
  13
+		"object": true,
  14
+		"applet": true
  15
+	},
  16
+
9 17
 	data: function( elem, name, data ) {
  18
+		if ( jQuery.noData[elem.nodeNode.toLowerCase()] ) {
  19
+			return;
  20
+		}
  21
+
10 22
 		elem = elem == window ?
11 23
 			windowData :
12 24
 			elem;
@@ -43,6 +55,10 @@ jQuery.extend({
43 55
 	},
44 56
 
45 57
 	removeData: function( elem, name ) {
  58
+		if ( jQuery.noData[elem.nodeNode.toLowerCase()] ) {
  59
+			return;
  60
+		}
  61
+
46 62
 		elem = elem == window ?
47 63
 			windowData :
48 64
 			elem;
2  src/manipulation.js
@@ -463,7 +463,7 @@ jQuery.extend({
463 463
 
464 464
 function cleanData( elems ) {
465 465
 	for ( var i = 0, elem, id; (elem = elems[i]) != null; i++ ) {
466  
-		if ( (id = elem[expando]) ) {
  466
+		if ( !jQuery.noData[elem.nodeNode.toLowerCase()] && (id = elem[expando]) ) {
467 467
 			delete jQuery.cache[ id ];
468 468
 		}
469 469
 	}

1 note on commit 5980292

John Resig

Fixed obvious dumb-ness in ed93204.

Please sign in to comment.
Something went wrong with that request. Please try again.