Update LAB.src.js
to support chrome-extension
What's the motivation for this change? It seems you are saying that chrome extensions have urls like "---://some.tld/..." with literal - dashes instead of http/https/file/etc? That seems bizarre, if I'm interpreting your code change correctly.
Also, shouldn't you just be able to use LABjs with explicit URLs, or by setting the BasePath configuration, thereby ignoring any of the automatic URL negotiation?
The location.href mybe like this "chrome-extension://kkpoepbkjgkbbaahccibkoibcnfbbdbc/index.html" in an chrome extension app.When LAB.js was used in chome extension app.The \w in the regexp of line 19th will lead an error, because of that the character "-" will not match \w.The error message is: Uncaught TypeError: Cannot read property '0' of null LAB.js:19
[source code] 18 root_page = /^[^?#]*//.exec(location.href)[0] 19 root_domain = /^\w+:///?[^/]+/.exec(root_page)[0]
in this case: root_page="chrome-extension://kkpoepbkjgkbbaahccibkoibcnfbbdbc/"
I use [\w|-] instead of \w to support pattern like "chrome-extension" .
Interesting. This may be related to #93. I might make a separate fork branch with slight tweaks that deal with non-standard/unexpected location values in a more robust way.
I'm not sure when/if those changes would roll into the main branch and necessitate an update (not sure I think these niche cases justify a 2.0.4 patch release). But at least the separate branch would provide an alternate copy for those who need to use LABjs in those unusual conditions.
I think there will someday be a LAB 2.1 release (or whatever), as over the years several tiny things have been requested. None of them are enough to justify a new release, but taken altogether, I think we'll eventually get to the point where another release comes out, and we'll certainly pull this one in at that time.
3q for your patient reply
JFYI,
I am also experiencing this issue in Apache Cordova applications for Windows Phone. The urls there have a dash in the 'ms-appx' prefix. For instance: ms-appx://com.mycompany.myapp/www/index.html