Skip to content
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 into
ansman:masterfrom
andymantell:feature/fix-runValidations-flow-in-ie8
May 20, 2016
Merged

Fix broken flow through runValidations in IE8#128
ansman merged 1 commit into
ansman:masterfrom
andymantell:feature/fix-runValidations-flow-in-ie8

Conversation

@andymantell

Copy link
Copy Markdown
Contributor

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 runValidations function which checks if attributes is a dom element (isDomElement). It was doing this by checking if querySelectorAll and querySelector had 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.forEach and a few others) without diminishing functionality in modern browsers.

runValidations was failing in the isDomElement test due to testing if querySelector and querySelectorAll were functions, which fails in IE8
@ansman

ansman commented May 20, 2016

Copy link
Copy Markdown
Owner

This definitely sounds resonable, it that's all it takes besides the polyfills!

@ansman
ansman merged commit d00b423 into ansman:master May 20, 2016
@ansman

ansman commented May 20, 2016

Copy link
Copy Markdown
Owner

This is now released in 0.10.0

@andymantell

Copy link
Copy Markdown
Contributor Author

Thanks @ansman, much appreciated

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants