|
|
@@ -2,9 +2,9 @@
|
|
|
|
|
|
import config from '../config'
|
|
|
import { warn } from './debug'
|
|
|
-import { nativeWatch } from './env'
|
|
|
import { set } from '../observer/index'
|
|
|
-import { hasSymbol } from '../util/index'
|
|
|
+import { unicodeLetters } from './lang'
|
|
|
+import { nativeWatch, hasSymbol } from './env'
|
|
|
|
|
|
import {
|
|
|
ASSET_TYPES,
|
|
|
@@ -264,11 +264,10 @@ function checkComponents (options: Object) {
|
|
|
}
|
|
|
|
|
|
export function validateComponentName (name: string) {
|
|
|
- if (!/^[a-zA-Z][\w-]*$/.test(name)) {
|
|
|
+ if (!new RegExp(`^[a-zA-Z][\\-\\.0-9_${unicodeLetters}]*$`).test(name)) {
|
|
|
warn(
|
|
|
'Invalid component name: "' + name + '". Component names ' +
|
|
|
- 'can only contain alphanumeric characters and the hyphen, ' +
|
|
|
- 'and must start with a letter.'
|
|
|
+ 'should conform to valid custom element name in html5 specification.'
|
|
|
)
|
|
|
}
|
|
|
if (isBuiltInTag(name) || config.isReservedTag(name)) {
|