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

reusing onRE #5130

Merged
merged 7 commits into from
Mar 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/compiler/error-detector.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* @flow */

import { dirRE } from './parser/index'
import { dirRE, onRE } from './parser/index'

// operators like typeof, instanceof and in are allowed
const prohibitedKeywordRE = new RegExp('\\b' + (
Expand All @@ -11,7 +11,6 @@ const prohibitedKeywordRE = new RegExp('\\b' + (
const unaryOperatorsRE = new RegExp('\\b' + (
'delete,typeof,void'
).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)')
const eventAttrRE = /^@|^v-on:/
// check valid identifier for v-for
const identRE = /[A-Za-z_$][\w$]*/
// strip strings in expressions
Expand All @@ -34,7 +33,7 @@ function checkNode (node: ASTNode, errors: Array<string>) {
if (value) {
if (name === 'v-for') {
checkFor(node, `v-for="${value}"`, errors)
} else if (eventAttrRE.test(name)) {
} else if (onRE.test(name)) {
checkEvent(value, `${name}="${value}"`, errors)
} else {
checkExpression(value, `${name}="${value}"`, errors)
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/parser/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ import {
} from '../helpers'

export const dirRE = /^v-|^@|^:/
export const onRE = /^@|^v-on:/
export const forAliasRE = /(.*?)\s+(?:in|of)\s+(.*)/
export const forIteratorRE = /\((\{[^}]*\}|[^,]*),([^,]*)(?:,([^,]*))?\)/
const bindRE = /^:|^v-bind:/
const onRE = /^@|^v-on:/
const argRE = /:(.*)$/
const modifierRE = /\.[^.]+/g

Expand Down