Skip to content

Commit

Permalink
Additional fallback for IE11 Script Access Denied error, close #165
Browse files Browse the repository at this point in the history
  • Loading branch information
zloirock committed Mar 8, 2016
1 parent cfc432a commit fb3ff34
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
9 changes: 8 additions & 1 deletion library/modules/_classof.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,18 @@ var cof = require('./_cof')
// ES3 wrong here
, ARG = cof(function(){ return arguments; }()) == 'Arguments';

// fallback for IE11 Script Access Denied error
var tryGet = function(it, key){
try {
return it[key];
} catch(e){ /* empty */ }
};

module.exports = function(it){
var O, T, B;
return it === undefined ? 'Undefined' : it === null ? 'Null'
// @@toStringTag case
: typeof (T = (O = Object(it))[TAG]) == 'string' ? T
: typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T
// builtinTag case
: ARG ? cof(O)
// ES3 arguments fallback
Expand Down
9 changes: 8 additions & 1 deletion modules/_classof.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,18 @@ var cof = require('./_cof')
// ES3 wrong here
, ARG = cof(function(){ return arguments; }()) == 'Arguments';

// fallback for IE11 Script Access Denied error
var tryGet = function(it, key){
try {
return it[key];
} catch(e){ /* empty */ }
};

module.exports = function(it){
var O, T, B;
return it === undefined ? 'Undefined' : it === null ? 'Null'
// @@toStringTag case
: typeof (T = (O = Object(it))[TAG]) == 'string' ? T
: typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T
// builtinTag case
: ARG ? cof(O)
// ES3 arguments fallback
Expand Down

0 comments on commit fb3ff34

Please sign in to comment.