11/*!
2- * Vue.js v2.0.0-rc.5
2+ * Vue.js v2.0.0-rc.6
33 * (c) 2014-2016 Evan You
44 * Released under the MIT License.
55 */
@@ -181,8 +181,8 @@ function isPlainObject (obj) {
181181 * Merge an Array of Objects into a single Object.
182182 */
183183function 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 ++ ) {
186186 if ( arr [ i ] ) {
187187 extend ( res , arr [ i ] )
188188 }
@@ -977,9 +977,9 @@ var Observer = function Observer (value) {
977977 * value type is Object.
978978 */
979979Observer . 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 ] ] )
983983 }
984984} ;
985985
@@ -1276,7 +1276,11 @@ function initMethods (vm) {
12761276 var methods = vm . $options . methods
12771277 if ( methods ) {
12781278 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+ }
12801284 }
12811285 }
12821286}
@@ -2156,6 +2160,13 @@ function renderMixin (Vue) {
21562160 var staticRenderFns = ref . staticRenderFns ;
21572161 var _parentVnode = ref . _parentVnode ;
21582162
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+
21592170 if ( staticRenderFns && ! vm . _staticTrees ) {
21602171 vm . _staticTrees = [ ]
21612172 }
@@ -2274,20 +2285,14 @@ function renderMixin (Vue) {
22742285 fallback
22752286 ) {
22762287 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
22912296 }
22922297 return slotNodes || fallback
22932298 }
@@ -2972,7 +2977,7 @@ function assertProp (
29722977 return
29732978 }
29742979 var type = prop . type
2975- var valid = ! type
2980+ var valid = ! type || type === true
29762981 var expectedTypes = [ ]
29772982 if ( type ) {
29782983 if ( ! Array . isArray ( type ) ) {
@@ -3290,7 +3295,7 @@ Object.defineProperty(Vue.prototype, '$isServer', {
32903295 get : function ( ) { return config . _isServer ; }
32913296} )
32923297
3293- Vue . version = '2.0.0-rc.5 '
3298+ Vue . version = '2.0.0-rc.6 '
32943299
32953300/* */
32963301
@@ -3514,17 +3519,6 @@ var isIE = UA$1 && /msie|trident/.test(UA$1)
35143519var isIE9 = UA$1 && UA$1 . indexOf ( 'msie 9.0' ) > 0
35153520var isAndroid = UA$1 && UA$1 . indexOf ( 'android' ) > 0
35163521
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-
35283522/**
35293523 * Query an element selector if it's not an element already.
35303524 */
@@ -5473,6 +5467,26 @@ setTimeout(function () {
54735467
54745468/* */
54755469
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+
54765490var decoder = document . createElement ( 'div' )
54775491
54785492function decodeHTML ( html ) {
@@ -5527,15 +5541,19 @@ var isSpecialTag = makeMap('script,style', true)
55275541
55285542var reCache = { }
55295543
5530- var ampRE = / & a m p ; / g
55315544var ltRE = / & l t ; / g
55325545var gtRE = / & g t ; / g
5546+ var nlRE = / & # 1 0 ; / g
5547+ var ampRE = / & a m p ; / g
55335548var quoteRE = / & q u o t ; / g
55345549
5535- function decodeAttr ( value , shouldDecodeTags ) {
5550+ function decodeAttr ( value , shouldDecodeTags , shouldDecodeNewlines ) {
55365551 if ( shouldDecodeTags ) {
55375552 value = value . replace ( ltRE , '<' ) . replace ( gtRE , '>' )
55385553 }
5554+ if ( shouldDecodeNewlines ) {
5555+ value = value . replace ( nlRE , '\n' )
5556+ }
55395557 return value . replace ( ampRE , '&' ) . replace ( quoteRE , '"' )
55405558}
55415559
@@ -5544,7 +5562,6 @@ function parseHTML (html, options) {
55445562 var expectHTML = options . expectHTML
55455563 var isUnaryTag = options . isUnaryTag || no
55465564 var isFromDOM = options . isFromDOM
5547- var shouldDecodeTags = options . shouldDecodeTags
55485565 var index = 0
55495566 var last , lastTag
55505567 while ( html ) {
@@ -5694,7 +5711,11 @@ function parseHTML (html, options) {
56945711 var value = args [ 3 ] || args [ 4 ] || args [ 5 ] || ''
56955712 attrs [ i ] = {
56965713 name : args [ 1 ] ,
5697- value : isFromDOM ? decodeAttr ( value , shouldDecodeTags ) : value
5714+ value : isFromDOM ? decodeAttr (
5715+ value ,
5716+ options . shouldDecodeTags ,
5717+ options . shouldDecodeNewlines
5718+ ) : value
56985719 }
56995720 }
57005721
@@ -6027,6 +6048,7 @@ function parse (
60276048 isUnaryTag : options . isUnaryTag ,
60286049 isFromDOM : options . isFromDOM ,
60296050 shouldDecodeTags : options . shouldDecodeTags ,
6051+ shouldDecodeNewlines : options . shouldDecodeNewlines ,
60306052 start : function start ( tag , attrs , unary ) {
60316053 // check namespace.
60326054 // inherit parent ns if there is one
@@ -7292,6 +7314,7 @@ Vue.prototype.$mount = function (
72927314 warn : warn ,
72937315 isFromDOM : isFromDOM ,
72947316 shouldDecodeTags : shouldDecodeTags ,
7317+ shouldDecodeNewlines : shouldDecodeNewlines ,
72957318 delimiters : options . delimiters
72967319 } , this ) ;
72977320 var render = ref . render ;
0 commit comments