Skip to content

Commit

Permalink
ReactSWFCompat now stops IE8 leaking on SWF unload
Browse files Browse the repository at this point in the history
  • Loading branch information
syranide committed Jul 14, 2016
1 parent 8d41c08 commit 90ab856
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 10 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-swf",
"version": "1.0.4",
"version": "1.0.5",
"license": "MIT",
"description": "Shockwave Flash Player component for React",
"authors": ["Andreas Svensson <andreas@syranide.com>"],
Expand Down
16 changes: 15 additions & 1 deletion npm-react-swf/compat.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! react-swf v1.0.4 | @syranide | MIT license */
/*! react-swf v1.0.5 | @syranide | MIT license */

'use strict';

Expand Down Expand Up @@ -52,6 +52,20 @@ ReactSWFCompat.prototype.componentDidUpdate = function() {
ReactDOM.render(swfElement, this._container);
};

ReactSWFCompat.prototype.componentWillUnmount = function() {
// IE8 leaks nodes if AS3 `ExternalInterface.addCallback`-functions remain.
if (document.documentMode < 9) {
var node = this.getFPDOMNode();

// Node-methods are not enumerable in IE8, but properties are.
for (var key in node) {
if (typeof node[key] === 'function') {
node[key] = null;
}
}
}
};

ReactSWFCompat.prototype.render = function() {
var containerProps = {
ref: this._containerRefCallback
Expand Down
2 changes: 1 addition & 1 deletion npm-react-swf/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-swf",
"version": "1.0.4",
"version": "1.0.5",
"license": "MIT",
"description": "Shockwave Flash Player component for React",
"author": "Andreas Svensson <andreas@syranide.com>",
Expand Down
2 changes: 1 addition & 1 deletion npm-react-swf/react-swf.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! react-swf v1.0.4 | @syranide | MIT license */
/*! react-swf v1.0.5 | @syranide | MIT license */

'use strict';

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-swf",
"version": "1.0.4",
"version": "1.0.5",
"license": "MIT",
"description": "Shockwave Flash Player component for React",
"author": "Andreas Svensson <andreas@syranide.com>",
Expand Down
16 changes: 15 additions & 1 deletion react-swf-compat.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! react-swf v1.0.4 | @syranide | MIT license */
/*! react-swf v1.0.5 | @syranide | MIT license */

(function(root, factory) {
if (typeof define === 'function' && define.amd) {
Expand Down Expand Up @@ -57,6 +57,20 @@
ReactDOM.render(swfElement, this._container);
};

ReactSWFCompat.prototype.componentWillUnmount = function() {
// IE8 leaks nodes if AS3 `ExternalInterface.addCallback`-functions remain.
if (document.documentMode < 9) {
var node = this.getFPDOMNode();

// Node-methods are not enumerable in IE8, but properties are.
for (var key in node) {
if (typeof node[key] === 'function') {
node[key] = null;
}
}
}
};

ReactSWFCompat.prototype.render = function() {
var containerProps = {
ref: this._containerRefCallback
Expand Down
4 changes: 2 additions & 2 deletions react-swf-compat.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion react-swf.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! react-swf v1.0.4 | @syranide | MIT license */
/*! react-swf v1.0.5 | @syranide | MIT license */

(function(root, factory) {
if (typeof define === 'function' && define.amd) {
Expand Down
2 changes: 1 addition & 1 deletion react-swf.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 90ab856

Please sign in to comment.