Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(commons): avoid unicode regex encoding in axe.min.js #2024

Merged
merged 3 commits into from
Feb 10, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: return unicode as literal instead of a regexp object
  • Loading branch information
jeeyyy committed Feb 6, 2020
commit 4856533db4bc3a0dd843873f40d1f1d44a328b1b
54 changes: 29 additions & 25 deletions lib/commons/text/unicode.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,31 +71,35 @@ function getUnicodeNonBmpRegExp() {
* Regex for matching astral plane unicode
* - http://kourge.net/projects/regexp-unicode-block
*/
return new RegExp(
'[' +
'\u1D00-\u1D7F' + // Phonetic Extensions
'\u1D80-\u1DBF' + // Phonetic Extensions Supplement
'\u1DC0-\u1DFF' + // Combining Diacritical Marks Supplement
// '\u2000-\u206F' + // General punctuation - handled in -> getPunctuationRegExp
'\u20A0-\u20CF' + // Currency symbols
'\u20D0-\u20FF' + // Combining Diacritical Marks for Symbols
'\u2100-\u214F' + // Letter like symbols
'\u2150-\u218F' + // Number forms (eg: Roman numbers)
'\u2190-\u21FF' + // Arrows
'\u2200-\u22FF' + // Mathematical operators
'\u2300-\u23FF' + // Misc Technical
'\u2400-\u243F' + // Control pictures
'\u2440-\u245F' + // OCR
'\u2460-\u24FF' + // Enclosed alpha numerics
'\u2500-\u257F' + // Box Drawing
'\u2580-\u259F' + // Block Elements
'\u25A0-\u25FF' + // Geometric Shapes
'\u2600-\u26FF' + // Misc Symbols
'\u2700-\u27BF' + // Dingbats
'\uE000-\uF8FF' + // Private Use
']',
'g'
);


/**
* Notes on various unicode planes being used in the regex below:
* '\u1D00-\u1D7F' Phonetic Extensions
* '\u1D80-\u1DBF' Phonetic Extensions Supplement
* '\u1DC0-\u1DFF' Combining Diacritical Marks Supplement
*
*'\u20A0-\u20CF' Currency symbols
*'\u20D0-\u20FF' Combining Diacritical Marks for Symbols
*'\u2100-\u214F' Letter like symbols
*'\u2150-\u218F' Number forms (eg: Roman numbers)
*'\u2190-\u21FF' Arrows
*'\u2200-\u22FF' Mathematical operators
*'\u2300-\u23FF' Misc Technical
*'\u2400-\u243F' Control pictures
*'\u2440-\u245F' OCR
*'\u2460-\u24FF' Enclosed alpha numerics
*'\u2500-\u257F' Box Drawing
*'\u2580-\u259F' Block Elements
*'\u25A0-\u25FF' Geometric Shapes
*'\u2600-\u26FF' Misc Symbols
*'\u2700-\u27BF' Dingbats
*'\uE000-\uF8FF' Private Use
*
* Note: plane '\u2000-\u206F' used for General punctuation is excluded as it is handled in -> getPunctuationRegExp
*/

return /[\u1D00-\u1D7F\u1D80-\u1DBF\u1DC0-\u1DFF\u20A0-\u20CF\u20D0-\u20FF\u2100-\u214F\u2150-\u218F\u2190-\u21FF\u2200-\u22FF\u2300-\u23FF\u2400-\u243F\u2440-\u245F\u2460-\u24FF\u2500-\u257F\u2580-\u259F\u25A0-\u25FF\u2600-\u26FF\u2700-\u27BF\uE000-\uF8FF]/g
}

/**
Expand Down