mirror of
https://github.com/jquery/jquery.git
synced 2026-04-20 03:01:22 -04:00
Fix #8335: Avoid memory leak by never setting data on non-element non-document nodes. Close gh-1127.
This commit is contained in:
committed by
Richard Gibson
parent
a96aa9e270
commit
cc324abf73
@@ -223,6 +223,11 @@ jQuery.extend({
|
||||
|
||||
// A method for determining if a DOM node can handle the data expando
|
||||
acceptData: function( elem ) {
|
||||
// Do not set data on non-element because it will not be cleared (#8335).
|
||||
if ( elem.nodeType && elem.nodeType !== 1 && elem.nodeType !== 9 ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ];
|
||||
|
||||
// nodes accept data unless otherwise specified; rejection can be conditional
|
||||
|
||||
Reference in New Issue
Block a user