-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
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
feat(compiler): allow unicode characters for component name as described in #8564 #8666
Changes from 2 commits
a350926
ee393db
9ef245e
dff7849
d845cf1
31d5059
dfc51bf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
/* @flow */ | ||
|
||
/** | ||
* unicode letters used for parsing html tags, component names and property paths. | ||
* use https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname | ||
* except \u10000-\uEFFFF because of performance problem | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I made a benchmark for this and it turns out that in most modern browsers except Safari, it runs fastest if we include There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, in my computer, |
||
*/ | ||
export const unicodeLetters = 'a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD' | ||
|
||
/** | ||
* Check if a string starts with $ or _ | ||
*/ | ||
|
@@ -23,7 +30,7 @@ export function def (obj: Object, key: string, val: any, enumerable?: boolean) { | |
/** | ||
* Parse simple path. | ||
*/ | ||
const bailRE = /[^\w.$]/ | ||
const bailRE = new RegExp(`[^${unicodeLetters}.$]`) | ||
export function parsePath (path: string): any { | ||
if (bailRE.test(path)) { | ||
return | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'a-zA-Z' is repeat in unicodeLetters