Skip to content
This repository has been archived by the owner on Apr 11, 2018. It is now read-only.

Make it ie8 compatible (sort of). #428

Closed
wants to merge 2 commits into from
Closed

Conversation

NStal
Copy link

@NStal NStal commented Feb 24, 2014

In modern js engine a array like [1,2,3,] will be intepreted as [1,2,3]

But under IE8 it turns to [1,2,3,undefined]

I fix some little issue related with it. After this fix it's able to run under IE8 with some(many) other pollyfill. But those pollyfills can be done out side the swig.

@NStal NStal mentioned this pull request Feb 24, 2014
@@ -255,6 +255,9 @@ function reader(str) {

utils.some(rules, function (rule) {
return utils.some(rule.regex, function (regex) {
if(!regex){
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utils.some will not execute the function if rule.regex does not exist or is an empty array.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I mentioned above when rule.regex is [a,b,c,undefined] then the last regex will probably be undefined (depend on the return value of the regex before it). Both remove the trailing comma or add this check will prevent the issue. If I remove this check we should make sure there are no trailing comma at any where https://github.com/NStal/swig/blob/master/lib/lexer.js#L76 in future.

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