Skip to content

Commit 305a491

Browse files
committed
adjust v-bind, v-on compilation priority
1 parent 2561376 commit 305a491

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

src/compiler/compile.js

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,34 @@ function compileDirectives (attrs, options) {
561561
})
562562
} else
563563

564+
// event handlers
565+
if (onRE.test(name)) {
566+
dirs.push({
567+
name: 'on',
568+
arg: name.replace(onRE, ''),
569+
descriptors: [newDirParser.parse(value)],
570+
def: options.directives.on
571+
})
572+
} else
573+
574+
// attribute bindings
575+
if (bindRE.test(name)) {
576+
var attributeName = name.replace(bindRE, '')
577+
if (attributeName === 'style' || attributeName === 'class') {
578+
dirName = attributeName
579+
arg = undefined
580+
} else {
581+
dirName = 'attr'
582+
arg = attributeName
583+
}
584+
dirs.push({
585+
name: dirName,
586+
arg: arg,
587+
descriptors: [newDirParser.parse(value)],
588+
def: options.directives[dirName]
589+
})
590+
} else
591+
564592
// Core directive
565593
if (name.indexOf(config.prefix) === 0) {
566594
// check literal
@@ -603,34 +631,6 @@ function compileDirectives (attrs, options) {
603631
}
604632
} else
605633

606-
// event handlers
607-
if (onRE.test(name)) {
608-
dirs.push({
609-
name: 'on',
610-
arg: name.replace(onRE, ''),
611-
descriptors: [newDirParser.parse(value)],
612-
def: options.directives.on
613-
})
614-
} else
615-
616-
// attribute bindings
617-
if (bindRE.test(name)) {
618-
var attributeName = name.replace(bindRE, '')
619-
if (attributeName === 'style' || attributeName === 'class') {
620-
dirName = attributeName
621-
arg = undefined
622-
} else {
623-
dirName = 'attr'
624-
arg = attributeName
625-
}
626-
dirs.push({
627-
name: dirName,
628-
arg: arg,
629-
descriptors: [newDirParser.parse(value)],
630-
def: options.directives[dirName]
631-
})
632-
} else
633-
634634
// TODO: remove this in 1.0.0
635635
if (config.interpolate) {
636636
dir = collectAttrDirective(name, value, options)

0 commit comments

Comments
 (0)