Revert "Removed unnecessary try/catch from isInstanceOf"
This reverts commit 58ee52ad4a
.
As it turns out, IE9 allows use of instanceof with special object types, not
just functions. One such example is HTMLElement; its type is `object', whereas
in Firefox and Chromium it is `function'. There is no reliable way to perform
this detection.
Therefore, the try/catch here is more reliable.
newmaster
parent
8391bc007d
commit
bb98c9afb3
|
@ -244,14 +244,16 @@ exports.isInstanceOf = function( type, instance )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check prototype chain (will throw an error if type is not a
|
try
|
||||||
// constructor (function)
|
|
||||||
if ( ( typeof type === 'function' )
|
|
||||||
&& ( instance instanceof type )
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
return true;
|
// check prototype chain (will throw an error if type is not a
|
||||||
|
// constructor (function)
|
||||||
|
if ( instance instanceof type )
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
catch ( e ) {}
|
||||||
|
|
||||||
// if no metadata is available, then our remaining checks cannot be
|
// if no metadata is available, then our remaining checks cannot be
|
||||||
// performed
|
// performed
|
||||||
|
|
Loading…
Reference in New Issue