1
1
/*!
2
- * Vue.js v2.0.0-rc.5
2
+ * Vue.js v2.0.0-rc.6
3
3
* (c) 2014-2016 Evan You
4
4
* Released under the MIT License.
5
5
*/
@@ -181,8 +181,8 @@ function isPlainObject (obj) {
181
181
* Merge an Array of Objects into a single Object.
182
182
*/
183
183
function toObject ( arr ) {
184
- var res = arr [ 0 ] || { }
185
- for ( var i = 1 ; i < arr . length ; i ++ ) {
184
+ var res = { }
185
+ for ( var i = 0 ; i < arr . length ; i ++ ) {
186
186
if ( arr [ i ] ) {
187
187
extend ( res , arr [ i ] )
188
188
}
@@ -977,9 +977,9 @@ var Observer = function Observer (value) {
977
977
* value type is Object.
978
978
*/
979
979
Observer . prototype . walk = function walk ( obj ) {
980
- var val = this . value
981
- for ( var key in obj ) {
982
- defineReactive ( val , key , obj [ key ] )
980
+ var keys = Object . keys ( obj )
981
+ for ( var i = 0 ; i < keys . length ; i ++ ) {
982
+ defineReactive ( obj , keys [ i ] , obj [ keys [ i ] ] )
983
983
}
984
984
} ;
985
985
@@ -1276,7 +1276,11 @@ function initMethods (vm) {
1276
1276
var methods = vm . $options . methods
1277
1277
if ( methods ) {
1278
1278
for ( var key in methods ) {
1279
- vm [ key ] = bind ( methods [ key ] , vm )
1279
+ if ( methods [ key ] != null ) {
1280
+ vm [ key ] = bind ( methods [ key ] , vm )
1281
+ } else if ( "development" !== 'production' ) {
1282
+ warn ( ( "Method \"" + key + "\" is undefined in options." ) , vm )
1283
+ }
1280
1284
}
1281
1285
}
1282
1286
}
@@ -2156,6 +2160,13 @@ function renderMixin (Vue) {
2156
2160
var staticRenderFns = ref . staticRenderFns ;
2157
2161
var _parentVnode = ref . _parentVnode ;
2158
2162
2163
+ if ( vm . _isMounted ) {
2164
+ // clone slot nodes on re-renders
2165
+ for ( var key in vm . $slots ) {
2166
+ vm . $slots [ key ] = cloneVNodes ( vm . $slots [ key ] )
2167
+ }
2168
+ }
2169
+
2159
2170
if ( staticRenderFns && ! vm . _staticTrees ) {
2160
2171
vm . _staticTrees = [ ]
2161
2172
}
@@ -2274,20 +2285,14 @@ function renderMixin (Vue) {
2274
2285
fallback
2275
2286
) {
2276
2287
var slotNodes = this . $slots [ name ]
2277
- if ( slotNodes ) {
2278
- // warn duplicate slot usage
2279
- if ( "development" !== 'production' ) {
2280
- slotNodes . _rendered && warn (
2281
- "Duplicate presense of slot \"" + name + "\" found in the same render tree " +
2282
- "- this will likely cause render errors." ,
2283
- this
2284
- )
2285
- slotNodes . _rendered = true
2286
- }
2287
- // clone slot nodes on re-renders
2288
- if ( this . _isMounted ) {
2289
- slotNodes = cloneVNodes ( slotNodes )
2290
- }
2288
+ // warn duplicate slot usage
2289
+ if ( slotNodes && "development" !== 'production' ) {
2290
+ slotNodes . _rendered && warn (
2291
+ "Duplicate presence of slot \"" + name + "\" found in the same render tree " +
2292
+ "- this will likely cause render errors." ,
2293
+ this
2294
+ )
2295
+ slotNodes . _rendered = true
2291
2296
}
2292
2297
return slotNodes || fallback
2293
2298
}
@@ -2972,7 +2977,7 @@ function assertProp (
2972
2977
return
2973
2978
}
2974
2979
var type = prop . type
2975
- var valid = ! type
2980
+ var valid = ! type || type === true
2976
2981
var expectedTypes = [ ]
2977
2982
if ( type ) {
2978
2983
if ( ! Array . isArray ( type ) ) {
@@ -3290,7 +3295,7 @@ Object.defineProperty(Vue.prototype, '$isServer', {
3290
3295
get : function ( ) { return config . _isServer ; }
3291
3296
} )
3292
3297
3293
- Vue . version = '2.0.0-rc.5 '
3298
+ Vue . version = '2.0.0-rc.6 '
3294
3299
3295
3300
/* */
3296
3301
@@ -3514,17 +3519,6 @@ var isIE = UA$1 && /msie|trident/.test(UA$1)
3514
3519
var isIE9 = UA$1 && UA$1 . indexOf ( 'msie 9.0' ) > 0
3515
3520
var isAndroid = UA$1 && UA$1 . indexOf ( 'android' ) > 0
3516
3521
3517
- // According to
3518
- // https://w3c.github.io/DOM-Parsing/#dfn-serializing-an-attribute-value
3519
- // when serializing innerHTML, <, >, ", & should be encoded as entities.
3520
- // However, only some browsers, e.g. PhantomJS, encodes < and >.
3521
- // this causes problems with the in-browser parser.
3522
- var shouldDecodeTags = inBrowser ? ( function ( ) {
3523
- var div = document . createElement ( 'div' )
3524
- div . innerHTML = '<div a=">">'
3525
- return div . innerHTML . indexOf ( '>' ) > 0
3526
- } ) ( ) : false
3527
-
3528
3522
/**
3529
3523
* Query an element selector if it's not an element already.
3530
3524
*/
@@ -5473,6 +5467,26 @@ setTimeout(function () {
5473
5467
5474
5468
/* */
5475
5469
5470
+ // check whether current browser encodes a char inside attribute values
5471
+ function shouldDecode ( content , encoded ) {
5472
+ var div = document . createElement ( 'div' )
5473
+ div . innerHTML = "<div a=\"" + content + "\">"
5474
+ return div . innerHTML . indexOf ( encoded ) > 0
5475
+ }
5476
+
5477
+ // According to
5478
+ // https://w3c.github.io/DOM-Parsing/#dfn-serializing-an-attribute-value
5479
+ // when serializing innerHTML, <, >, ", & should be encoded as entities.
5480
+ // However, only some browsers, e.g. PhantomJS, encodes < and >.
5481
+ // this causes problems with the in-browser parser.
5482
+ var shouldDecodeTags = inBrowser ? shouldDecode ( '>' , '>' ) : false
5483
+
5484
+ // #3663
5485
+ // IE encodes newlines inside attribute values while other browsers don't
5486
+ var shouldDecodeNewlines = inBrowser ? shouldDecode ( '\n' , ' ' ) : false
5487
+
5488
+ /* */
5489
+
5476
5490
var decoder = document . createElement ( 'div' )
5477
5491
5478
5492
function decodeHTML ( html ) {
@@ -5527,15 +5541,19 @@ var isSpecialTag = makeMap('script,style', true)
5527
5541
5528
5542
var reCache = { }
5529
5543
5530
- var ampRE = / & a m p ; / g
5531
5544
var ltRE = / & l t ; / g
5532
5545
var gtRE = / & g t ; / g
5546
+ var nlRE = / & # 1 0 ; / g
5547
+ var ampRE = / & a m p ; / g
5533
5548
var quoteRE = / & q u o t ; / g
5534
5549
5535
- function decodeAttr ( value , shouldDecodeTags ) {
5550
+ function decodeAttr ( value , shouldDecodeTags , shouldDecodeNewlines ) {
5536
5551
if ( shouldDecodeTags ) {
5537
5552
value = value . replace ( ltRE , '<' ) . replace ( gtRE , '>' )
5538
5553
}
5554
+ if ( shouldDecodeNewlines ) {
5555
+ value = value . replace ( nlRE , '\n' )
5556
+ }
5539
5557
return value . replace ( ampRE , '&' ) . replace ( quoteRE , '"' )
5540
5558
}
5541
5559
@@ -5544,7 +5562,6 @@ function parseHTML (html, options) {
5544
5562
var expectHTML = options . expectHTML
5545
5563
var isUnaryTag = options . isUnaryTag || no
5546
5564
var isFromDOM = options . isFromDOM
5547
- var shouldDecodeTags = options . shouldDecodeTags
5548
5565
var index = 0
5549
5566
var last , lastTag
5550
5567
while ( html ) {
@@ -5694,7 +5711,11 @@ function parseHTML (html, options) {
5694
5711
var value = args [ 3 ] || args [ 4 ] || args [ 5 ] || ''
5695
5712
attrs [ i ] = {
5696
5713
name : args [ 1 ] ,
5697
- value : isFromDOM ? decodeAttr ( value , shouldDecodeTags ) : value
5714
+ value : isFromDOM ? decodeAttr (
5715
+ value ,
5716
+ options . shouldDecodeTags ,
5717
+ options . shouldDecodeNewlines
5718
+ ) : value
5698
5719
}
5699
5720
}
5700
5721
@@ -6027,6 +6048,7 @@ function parse (
6027
6048
isUnaryTag : options . isUnaryTag ,
6028
6049
isFromDOM : options . isFromDOM ,
6029
6050
shouldDecodeTags : options . shouldDecodeTags ,
6051
+ shouldDecodeNewlines : options . shouldDecodeNewlines ,
6030
6052
start : function start ( tag , attrs , unary ) {
6031
6053
// check namespace.
6032
6054
// inherit parent ns if there is one
@@ -7292,6 +7314,7 @@ Vue.prototype.$mount = function (
7292
7314
warn : warn ,
7293
7315
isFromDOM : isFromDOM ,
7294
7316
shouldDecodeTags : shouldDecodeTags ,
7317
+ shouldDecodeNewlines : shouldDecodeNewlines ,
7295
7318
delimiters : options . delimiters
7296
7319
} , this ) ;
7297
7320
var render = ref . render ;
0 commit comments