Skip to content

Commit

Permalink
index: try/catch the Object.getOwnPropertyDescriptor() call
Browse files Browse the repository at this point in the history
On IE10 and probably others, this was a source of the `inspect()` call failing
  • Loading branch information
TooTallNate committed Feb 18, 2014
1 parent a7602ec commit 03f8c92
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,14 @@ function formatValue(ctx, value, recurseTimes) {
function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
var name, str, desc;
desc = { value: value[key] };
if (Object.getOwnPropertyDescriptor) {
desc = Object.getOwnPropertyDescriptor(value, key) || desc;
try {
// ie10 › Object.getOwnPropertyDescriptor(window.location, 'hash')
// throws TypeError: Object doesn't support this action
if (Object.getOwnPropertyDescriptor) {
desc = Object.getOwnPropertyDescriptor(value, key) || desc;
}
} catch (e) {
// ignore
}
if (desc.get) {
if (desc.set) {
Expand Down

0 comments on commit 03f8c92

Please sign in to comment.