1
1
/*
2
- VueJS v0.7.3
2
+ VueJS v0.7.4
3
3
(c) 2014 Evan You
4
4
License: MIT
5
5
*/
@@ -2265,7 +2265,9 @@ module.exports = Directive
2265
2265
} ) ;
2266
2266
require . register ( "vue/src/exp-parser.js" , function ( exports , require , module ) {
2267
2267
var utils = require ( './utils' ) ,
2268
- hasOwn = Object . prototype . hasOwnProperty
2268
+ hasOwn = Object . prototype . hasOwnProperty ,
2269
+ stringSaveRE = / " (?: [ ^ " \\ ] | \\ .) * " | ' (?: [ ^ ' \\ ] | \\ .) * ' / g,
2270
+ stringRestoreRE = / " ( \d + ) " / g
2269
2271
2270
2272
// Variable extraction scooped from https://github.com/RubyLouvre/avalon
2271
2273
@@ -2388,6 +2390,8 @@ module.exports = {
2388
2390
}
2389
2391
vars = utils . unique ( vars )
2390
2392
var accessors = '' ,
2393
+ has = utils . hash ( ) ,
2394
+ strings = [ ] ,
2391
2395
// construct a regex to extract all valid variable paths
2392
2396
// ones that begin with "$" are particularly tricky
2393
2397
// because we can't use \b for them
@@ -2396,16 +2400,35 @@ module.exports = {
2396
2400
vars . map ( escapeDollar ) . join ( '|' ) +
2397
2401
")[$\\w\\.]*\\b" , 'g'
2398
2402
) ,
2399
- body = ( 'return ' + exp ) . replace ( pathRE , function ( path ) {
2400
- // keep track of the first char
2401
- var c = path . charAt ( 0 )
2402
- path = path . slice ( 1 )
2403
- var val = 'this.' + getRel ( path , compiler ) + path
2404
- accessors += val + ';'
2405
- // don't forget to put that first char back
2406
- return c + val
2407
- } )
2403
+ body = ( 'return ' + exp )
2404
+ . replace ( stringSaveRE , saveStrings )
2405
+ . replace ( pathRE , replacePath )
2406
+ . replace ( stringRestoreRE , restoreStrings )
2408
2407
body = accessors + body
2408
+
2409
+ function saveStrings ( str ) {
2410
+ var i = strings . length
2411
+ strings [ i ] = str
2412
+ return '"' + i + '"'
2413
+ }
2414
+
2415
+ function replacePath ( path ) {
2416
+ // keep track of the first char
2417
+ var c = path . charAt ( 0 )
2418
+ path = path . slice ( 1 )
2419
+ var val = 'this.' + getRel ( path , compiler ) + path
2420
+ if ( ! has [ path ] ) {
2421
+ accessors += val + ';'
2422
+ has [ path ] = 1
2423
+ }
2424
+ // don't forget to put that first char back
2425
+ return c + val
2426
+ }
2427
+
2428
+ function restoreStrings ( str , i ) {
2429
+ return strings [ i ]
2430
+ }
2431
+
2409
2432
return makeGetter ( body , exp )
2410
2433
}
2411
2434
}
@@ -2808,10 +2831,6 @@ module.exports = {
2808
2831
this . el . innerHTML = utils . toText ( value )
2809
2832
} ,
2810
2833
2811
- visible : function ( value ) {
2812
- this . el . style . visibility = value ? '' : 'hidden'
2813
- } ,
2814
-
2815
2834
show : function ( value ) {
2816
2835
var el = this . el ,
2817
2836
target = value ? '' : 'none' ,
@@ -2833,27 +2852,8 @@ module.exports = {
2833
2852
this . lastVal = value
2834
2853
}
2835
2854
}
2836
- } ,
2837
-
2838
- style : {
2839
- bind : function ( ) {
2840
- this . arg = convertCSSProperty ( this . arg )
2841
- } ,
2842
- update : function ( value ) {
2843
- this . el . style [ this . arg ] = value
2844
- }
2845
2855
}
2846
- }
2847
2856
2848
- /**
2849
- * convert hyphen style CSS property to Camel style
2850
- */
2851
- var CONVERT_RE = / - ( .) / g
2852
- function convertCSSProperty ( prop ) {
2853
- if ( prop . charAt ( 0 ) === '-' ) prop = prop . slice ( 1 )
2854
- return prop . replace ( CONVERT_RE , function ( m , char ) {
2855
- return char . toUpperCase ( )
2856
- } )
2857
2857
}
2858
2858
} ) ;
2859
2859
require . register ( "vue/src/directives/if.js" , function ( exports , require , module ) {
0 commit comments