-
-
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
Conversation
- use unicode letters when parsing path for watcher instead of only ascii letters - extract const `unicodeLetters` from html-parser to lang
In addition to #8564 , I added support for unicode property path in watcher. |
src/core/util/lang.js
Outdated
/** | ||
* 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 comment
The 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 \u10000-\uEFFFF
:
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.
Well, in my computer, npm test
failed because of timeout when including \u10000-\uEFFFF
. It passed without the extra characters. I don't know why the performance difference exists, yet.
Co-Authored-By: youngrok <pak.youngrok@gmail.com>
… watch paths (vuejs#8666) close vuejs#8564
// except \u10000-\uEFFFF because of performance problem | ||
export const pcenchars = '[\\-\\.0-9_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]' | ||
const ncname = `[a-zA-Z_]${pcenchars}*` | ||
const ncname = `[a-zA-Z_][\\-\\.0-9_a-zA-Z${unicodeLetters}]*` |
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
resolve #8564
What kind of change does this PR introduce? (check at least one)
Does this PR introduce a breaking change? (check one)
If yes, please describe the impact and migration path for existing applications:
The PR fulfills these requirements:
dev
branch for v2.x (or to a previous version branch), not themaster
branchfix #xxx[,#xxx]
, where "xxx" is the issue number)If adding a new feature, the PR's description includes:
Other information: