This is now an actual repo:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When browsers implement ES6 template strings, add tags XRegExp.r (regex as raw string) and | |
XRegExp.rx (regex with implicit free-spacing, as raw string). Don't need tag XRegExp.raw (raw | |
string), because you should be able to use, e.g., XRegExp(String.raw`\w`). Don't need to support | |
flags /gy (which XRegExp doesn't allow in mode modifiers) with XRegExp.r/rx, since XRegExp methods | |
provide alternate mechanisms for /gy (scope 'all', the sticky option, lack of need for lastIndex | |
updating, and the XRegExp.globalize method if you really need it). All other flags (e.g., /im and | |
custom flags /snxA) can be applied via a leading mode modifier (e.g., XRegExp.r`(?s).`). | |
If the above sounds confusing, keep in mind that you can simply maintain the status quo but still | |
gain the benefits of raw multiline template strings (no more double escaping!) via, e.g., |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ---------------------------------------------------------- | |
// A short snippet for detecting versions of IE in JavaScript | |
// without resorting to user-agent sniffing | |
// ---------------------------------------------------------- | |
// If you're not in IE (or IE version is less than 5) then: | |
// ie === undefined | |
// If you're in IE (>=5) then you can determine which version: | |
// ie === 7; // IE7 | |
// Thus, to detect IE: | |
// if (ie) {} |
NewerOlder