Skip to content

Commit

Permalink
IE8 Fix, take 1
Browse files Browse the repository at this point in the history
  • Loading branch information
ifandelse committed May 12, 2014
1 parent 369af23 commit 6a75c60
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
9 changes: 7 additions & 2 deletions lib/postal.xframe.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
// out he didn"t know JavaScript, and our passports were stolen on the
// return trip. We stowed away aboard a freighter headed back to the
// US and by the time we got back, no one had heard of IE 8 or 9. True story.
var useEagerSerialize = /MSIE [8,9]/.test(navigator.userAgent);
var noPostMessageApply;
var useEagerSerialize = noPostMessageApply = /MSIE [8,9]/.test(navigator.userAgent);
var _memoRemoteByInstanceId = function (memo, instanceId) {
var proxy = _.find(this.remotes, function (x) {
return x.instanceId === instanceId;
Expand Down Expand Up @@ -83,7 +84,11 @@
if (!this.options.isWorker && !_envIsWorker) {
args.push(this.options.origin);
}
this.target.postMessage.apply(context, args);
if (noPostMessageApply) {
this.target.postMessage(args[0], args[1]);
} else {
this.target.postMessage.apply(context, args);
}
}
}
}, {
Expand Down
2 changes: 1 addition & 1 deletion lib/postal.xframe.min.js

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

11 changes: 8 additions & 3 deletions src/xframe.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* global postal */
/*jshint -W003 */
/*jshint -W003,-W120 */
var _origin = location.origin || location.protocol + "//" + location.host;

function listener() {
Expand All @@ -13,7 +13,8 @@ function listener() {
// out he didn"t know JavaScript, and our passports were stolen on the
// return trip. We stowed away aboard a freighter headed back to the
// US and by the time we got back, no one had heard of IE 8 or 9. True story.
var useEagerSerialize = /MSIE [8,9]/.test(navigator.userAgent);
var noPostMessageApply;
var useEagerSerialize = noPostMessageApply = /MSIE [8,9]/.test(navigator.userAgent);

var _memoRemoteByInstanceId = function(memo, instanceId) {
var proxy = _.find(this.remotes, function(x) {
Expand Down Expand Up @@ -72,7 +73,11 @@ var XFRAME = "xframe",
if (!this.options.isWorker && !_envIsWorker) {
args.push(this.options.origin);
}
this.target.postMessage.apply(context, args);
if (noPostMessageApply) {
this.target.postMessage(args[0], args[1]);
} else {
this.target.postMessage.apply(context, args);
}
}
}
}, {
Expand Down

0 comments on commit 6a75c60

Please sign in to comment.