Commonmark.js error under IE8

#1

In commonmark.js under IE8, there is an error reported in the console:

Line 1659: identifier, string or number expected

in: '∈',
0 Likes

#2

I suspect this is IE8 having problems with non-ascii characters in the source. I’ve changed the entities table to use integer character codes, which should fix the problem once we come out with the next release.

+++ Nicolas Cadilhac [Dec 09 14 19:41 ]:

0 Likes

#3
  1. Check that page has <meta charset="UTF-8">. You can also force encoding in <script> tag if needed.
  2. Make sure server really sends js in utf8.
0 Likes

#4
  1. Yes the tag is here.
  2. How do I check that? If I check in firebug in the Net tab (obviously in firefox, not in IE), I can clearly read the unicode characters in commonmark.js.
0 Likes

#5

Can you try it now? I’ve just pushed a new version of commonmark.js that uses character codes rather than unicode characters in the entity lookup table. (http://spec.commonmark.org/js/commonmark.js - this is what’s powering http://try.commonmark.org)

0 Likes

#6

Still the same error. But you know what? When I click on the line number, the IE debugger shows me the code and the “in” keyword is blue, although all the other identifiers are black. I don’t know if it’s the syntax highlighter or if there is something related to this word that is understood as a kind of keyword…

0 Likes

#7

Aha. Yes, it may well be that ‘in’ needs to be enclosed in quotes,
though modern browsers seem to be able to handle it without.

+++ Nicolas Cadilhac [Dec 10 14 20:30 ]:

0 Likes

#8

Hm… that’s strange.

Did you used simulation mode or real IE8 ? Could you try dingus of alternate parser?

0 Likes

#9

I recommend to setup eslint & automate syntax check with travis. With dynamic langs like JS, when no compile time checks available, linter helps to find >> 50% of errors and saves a lot of time. It also cares about specific syntax cases with old browsers.

0 Likes

#10

Thanks for the recommendation. I just tried eslint and it is much more comprehensive than what I’ve used before (jshint).

+++ Vitaly Puzrin [Dec 11 14 03:16 ]:

0 Likes

#11

Yeah, i’ve migrated all my projects from jshint to eslint couple of months ago. You can be sure, it will cover 100% of jshint features and will add 200% of new ones.

Some notes:

  1. You need hard freeze eslint version dependency, with build number. They still break things on minor updates.
  2. If you don’t wish to spend couple of days for reading all rules docs, you can start with my very restrictive template, and relax settings as you need. (run as node_modules/.bin/eslint --reset ./)
  3. Indentation check it not in eslint core, but available via our plugin - eslint-plugin-nodeca

I also worth to add coverage control. See targets coverage & test-ci in Makefile, how to do it.

0 Likes

#12

What do you mean?

I used the document mode IE8 under the debugger. But today I also checked the real IE8 under a virtual XP machine and this is the same error. ‘in’ is in blue and I remarked he is not alone. ‘int’ is also in blue.

0 Likes

#13

I’ve updated the script on try.commonmark.org to use ‘in’ in quotes.
Try again and see if that fixes things for you.

+++ Nicolas Cadilhac [Dec 11 14 16:12 ]:

0 Likes

#14

I mean 2 things:

  • I installed vitrualbox IE test image from microsoft, and could not reproduce bug in IE8 simulation mode. Test images can be downloaded here. I used latest with IE11.
    • may be, problem is not in IE8, but in combination of IE + OS. Not enougth info, how to reproduce.
  • I need to know, is it specific bug for reference parser of something more generic. If this demo of remarkable has error too, please post exact text & screenshot, if possible. Even if you think that error is exactly the same.

Also, tell me please your OS name / Servicepack number and exact IE8 version (with build number) where bug happened.

0 Likes

#15

Tried in the debugger of IE11 in IE8 mode but got:

var keys = Object.keys(add);
L’objet ne gère pas la propriété ou la méthode « keys »

I have no idea if it passed on the ‘in’ fix because of this (new?) error.

0 Likes

#16

You need https://github.com/es-shims/es5-shim . If will not help, then shim + sham (from the same package)

0 Likes

#17

A word of warning: IE11 in IE8 simulation mode may behave differently than IE8 - we’ve seen instances of this in the past with both DOM/rendering behavior and availability/behavior of javascript methods.

If you want to test ie8, you really need to download the ie8 VM from www.modern.ie.

0 Likes

#18

As said earlier, I also test under the XP mode of Win7.

0 Likes