2

I have been trying to make my website performs well. One way that may achieve this is by including a loader like LAB.js script inline within my HTML, and then load my scripts in parallel in the next line.

So, inside LAB.js library that contains a bunch of codes, there is this particular line of code{var c=/^\w+\:\/\//,d;if(typeof a!=q). When I put that piece of code inline inside the script tag of my HTML, it works well both In mozilla and chrome..but then..it fails in this browser called internet explorer 8 built by this great software company called "microsoft".

take a look at the part where there is "\/\//". Those last two characters "//" are parsed without any problem in both mozilla and chrome. However in IE, the last two characters are parsed as comment operators, therefore, any codes after those last two lines are rendered as comments (useless). This is really unbelievable. In IE, the rest of the codes after those two characters are literally useless and green colored (as in comment) Have anyone seen this issue happening before? Pls help. thanks.

In Mozilla and chrome: (last two characters)"//",d;if(typeof a!=q)

In IE: //,d;if(typeof a!=q)

Pointy
  • 405,095
  • 59
  • 585
  • 614
Benny Tjia
  • 4,853
  • 10
  • 39
  • 48
  • fascinating -- I've re-tagged your question so that the library author will see it :-) – Pointy Jun 16 '11 at 20:09
  • @Pointy: thanks for adding the tag! I was still in a shock-disbelief mode when i wrote this question that i even forgot to include the most important "LAB.js" tag :) – Benny Tjia Jun 16 '11 at 20:17

2 Answers2

2

You could surround your regex with (?:...):

 c=/(?:^\w+\:\/\/)/,d;if(typeof a!=q)
Blindy
  • 65,249
  • 10
  • 91
  • 131
1

what if you try,

c = new RegExp("^\w+\:\/\/"),d;if(typeof a!=q)
Pantelis
  • 6,086
  • 1
  • 18
  • 21