@@ -87,29 +87,26 @@ function linkAndCapture (linker, vm) {
8787 var originalDirCount = vm . _directives . length
8888 linker ( )
8989 var dirs = vm . _directives . slice ( originalDirCount )
90- var dir
90+ dirs . sort ( directiveComparator )
9191 for ( var i = 0 , l = dirs . length ; i < l ; i ++ ) {
92- dir = dirs [ i ]
93- if ( dir . name === 'if' ||
94- dir . name === 'for' ||
95- dir . name === 'repeat' ) {
96- dir . _bind ( )
97- }
98- }
99- for ( var i = 0 , l = dirs . length ; i < l ; i ++ ) {
100- dir = dirs [ i ]
101- if ( dir . name === 'component' ||
102- dir . name === 'el' ) {
103- dir . _bind ( )
104- }
105- }
106- for ( var i = 0 , l = dirs . length ; i < l ; i ++ ) {
107- dir = dirs [ i ]
108- if ( ! dir . _bound ) dir . _bind ( )
92+ dirs [ i ] . _bind ( )
10993 }
11094 return dirs
11195}
11296
97+ /**
98+ * Directive priority sort comparator
99+ *
100+ * @param {Object } a
101+ * @param {Object } b
102+ */
103+
104+ function directiveComparator ( a , b ) {
105+ a = a . _def . priority || 0
106+ b = b . _def . priority || 0
107+ return a > b ? - 1 : a === b ? 0 : 1
108+ }
109+
113110/**
114111 * Linker functions return an unlink function that
115112 * tearsdown all directives instances generated during
@@ -264,8 +261,10 @@ function compileElement (el, options) {
264261 // textarea treats its text content as the initial value.
265262 // just bind it as a v-attr directive for value.
266263 if ( el . tagName === 'TEXTAREA' ) {
267- if ( textParser . parse ( el . value ) ) {
268- el . setAttribute ( 'value' , el . value )
264+ var tokens = textParser . parse ( el . value )
265+ if ( tokens ) {
266+ el . setAttribute ( 'bind-value' , textParser . tokensToExp ( tokens ) )
267+ el . value = ''
269268 }
270269 }
271270 var linkFn
@@ -629,7 +628,6 @@ function compileDirectives (attrs, options) {
629628 }
630629 // sort by priority, LOW to HIGH
631630 if ( dirs . length ) {
632- dirs . sort ( directiveComparator )
633631 return makeNodeLinkFn ( dirs )
634632 }
635633}
@@ -717,16 +715,3 @@ function collectAttrDirective (name, value, options) {
717715 }
718716 }
719717}
720-
721- /**
722- * Directive priority sort comparator
723- *
724- * @param {Object } a
725- * @param {Object } b
726- */
727-
728- function directiveComparator ( a , b ) {
729- a = a . def . priority || 0
730- b = b . def . priority || 0
731- return a > b ? 1 : - 1
732- }
0 commit comments