Add comment

pull/21833/head
David Baker 2016-05-26 16:30:04 +01:00
parent 3a5e37aa84
commit 1664f46180
1 changed files with 9 additions and 0 deletions

View File

@ -107,7 +107,16 @@ module.exports = React.createClass({
//console.log("enter: "+JSON.stringify(node.props._restingStyle)); //console.log("enter: "+JSON.stringify(node.props._restingStyle));
} else if (node === null) { } else if (node === null) {
// Velocity stores data on elements using the jQuery .data()
// method, and assumes you'll be using jQuery's .remove() to
// remove the element, but we don't use jQuery, so we need to
// blow away the element's data explicitly otherwise it will leak.
// This uses Velocity's internal jQuery compatible wrapper.
// See the bug at
// https://github.com/julianshapiro/velocity/issues/300 // https://github.com/julianshapiro/velocity/issues/300
// and the FAQ entry, "Preventing memory leaks when
// creating/destroying large numbers of elements"
// (https://github.com/julianshapiro/velocity/issues/47)
Velocity.Utilities.removeData(this.nodes[k]); Velocity.Utilities.removeData(this.nodes[k]);
} }
this.nodes[k] = node; this.nodes[k] = node;