This repository was archived by the owner on Dec 12, 2021. It is now read-only.
Fix broken flow through runValidations in IE8 - #128
Merged
ansman merged 1 commit intoMay 20, 2016
Conversation
runValidations was failing in the isDomElement test due to testing if querySelector and querySelectorAll were functions, which fails in IE8
Owner
|
This definitely sounds resonable, it that's all it takes besides the polyfills! |
Owner
|
This is now released in 0.10.0 |
Contributor
Author
|
Thanks @ansman, much appreciated |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Hi,
I am aware that you don't officially support IE8, but I have got validate.js up and running perfectly by including various polyfills for the bits of missing JS functionality.
The only blocker to it running however was a test in the
runValidationsfunction which checks ifattributesis a dom element (isDomElement). It was doing this by checking ifquerySelectorAllandquerySelectorhad a type of function. The issue is that IE8 actually returns a type of 'object' for these native functions (See http://stackoverflow.com/questions/12933625/typeof-in-ie-8-for-native-functions). Therefore I have tweaked this test to merely check for the presence of these methods on the object and not to check on their type. I feel that it is reasonable to assume that if they are present, that they will be the native methods or something that functions equivalently (e.g. a polyfill) and that testing their type doesn't add any significant value.What are your thoughts? As I say, this small tweak allows the library to run nicely under IE8 (provided you polyfill things like
Array.prototype.forEachand a few others) without diminishing functionality in modern browsers.