Test that Node is a function before using instanceof on it #1180
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We use React on a page that also uses the Sarissa library (as part of RichFaces). This library defines its own
Node
object if the browser doesn't already have one (as IE8 does not). This causes theinstanceof
check in isNode.js to throw an error.Reduced test: http://coonrod.org/react/react-0.9.0/examples/basic/
This is the "basic" example from React using the unmodified React 0.9.0. I've added the Sarissa library as well as es5-shim.js and es5-sham.js. If you view it in IE8 you will see something like this:
and the timer does not time.
I believe you want to always use
instanceof
with a function anyway so it seems like a good thing to test when you don't know if you have a good Node or not.