Skip to content

Commit ace1076

Browse files
committed
[build] 2.0.0-rc.6
1 parent 45ff621 commit ace1076

File tree

8 files changed

+170
-149
lines changed

8 files changed

+170
-149
lines changed

dist/vue.common.js

Lines changed: 27 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,8 @@ function isPlainObject (obj) {
172172
* Merge an Array of Objects into a single Object.
173173
*/
174174
function toObject (arr) {
175-
var res = arr[0] || {}
176-
for (var i = 1; i < arr.length; i++) {
175+
var res = {}
176+
for (var i = 0; i < arr.length; i++) {
177177
if (arr[i]) {
178178
extend(res, arr[i])
179179
}
@@ -968,9 +968,9 @@ var Observer = function Observer (value) {
968968
* value type is Object.
969969
*/
970970
Observer.prototype.walk = function walk (obj) {
971-
var val = this.value
972-
for (var key in obj) {
973-
defineReactive(val, key, obj[key])
971+
var keys = Object.keys(obj)
972+
for (var i = 0; i < keys.length; i++) {
973+
defineReactive(obj, keys[i], obj[keys[i]])
974974
}
975975
};
976976

@@ -1269,7 +1269,11 @@ function initMethods (vm) {
12691269
var methods = vm.$options.methods
12701270
if (methods) {
12711271
for (var key in methods) {
1272-
vm[key] = bind(methods[key], vm)
1272+
if (methods[key] != null) {
1273+
vm[key] = bind(methods[key], vm)
1274+
} else if (process.env.NODE_ENV !== 'production') {
1275+
warn(("Method \"" + key + "\" is undefined in options."), vm)
1276+
}
12731277
}
12741278
}
12751279
}
@@ -2149,6 +2153,13 @@ function renderMixin (Vue) {
21492153
var staticRenderFns = ref.staticRenderFns;
21502154
var _parentVnode = ref._parentVnode;
21512155

2156+
if (vm._isMounted) {
2157+
// clone slot nodes on re-renders
2158+
for (var key in vm.$slots) {
2159+
vm.$slots[key] = cloneVNodes(vm.$slots[key])
2160+
}
2161+
}
2162+
21522163
if (staticRenderFns && !vm._staticTrees) {
21532164
vm._staticTrees = []
21542165
}
@@ -2267,20 +2278,14 @@ function renderMixin (Vue) {
22672278
fallback
22682279
) {
22692280
var slotNodes = this.$slots[name]
2270-
if (slotNodes) {
2271-
// warn duplicate slot usage
2272-
if (process.env.NODE_ENV !== 'production') {
2273-
slotNodes._rendered && warn(
2274-
"Duplicate presense of slot \"" + name + "\" found in the same render tree " +
2275-
"- this will likely cause render errors.",
2276-
this
2277-
)
2278-
slotNodes._rendered = true
2279-
}
2280-
// clone slot nodes on re-renders
2281-
if (this._isMounted) {
2282-
slotNodes = cloneVNodes(slotNodes)
2283-
}
2281+
// warn duplicate slot usage
2282+
if (slotNodes && process.env.NODE_ENV !== 'production') {
2283+
slotNodes._rendered && warn(
2284+
"Duplicate presence of slot \"" + name + "\" found in the same render tree " +
2285+
"- this will likely cause render errors.",
2286+
this
2287+
)
2288+
slotNodes._rendered = true
22842289
}
22852290
return slotNodes || fallback
22862291
}
@@ -2967,7 +2972,7 @@ function assertProp (
29672972
return
29682973
}
29692974
var type = prop.type
2970-
var valid = !type
2975+
var valid = !type || type === true
29712976
var expectedTypes = []
29722977
if (type) {
29732978
if (!Array.isArray(type)) {
@@ -3285,7 +3290,7 @@ Object.defineProperty(Vue.prototype, '$isServer', {
32853290
get: function () { return config._isServer; }
32863291
})
32873292

3288-
Vue.version = '2.0.0-rc.5'
3293+
Vue.version = '2.0.0-rc.6'
32893294

32903295
/* */
32913296

@@ -3507,17 +3512,6 @@ var isIE = UA$1 && /msie|trident/.test(UA$1)
35073512
var isIE9 = UA$1 && UA$1.indexOf('msie 9.0') > 0
35083513
var isAndroid = UA$1 && UA$1.indexOf('android') > 0
35093514

3510-
// According to
3511-
// https://w3c.github.io/DOM-Parsing/#dfn-serializing-an-attribute-value
3512-
// when serializing innerHTML, <, >, ", & should be encoded as entities.
3513-
// However, only some browsers, e.g. PhantomJS, encodes < and >.
3514-
// this causes problems with the in-browser parser.
3515-
var shouldDecodeTags = inBrowser ? (function () {
3516-
var div = document.createElement('div')
3517-
div.innerHTML = '<div a=">">'
3518-
return div.innerHTML.indexOf('&gt;') > 0
3519-
})() : false
3520-
35213515
/**
35223516
* Query an element selector if it's not an element already.
35233517
*/

dist/vue.js

Lines changed: 61 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
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
*/
183183
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++) {
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
*/
979979
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]])
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)
35143519
var isIE9 = UA$1 && UA$1.indexOf('msie 9.0') > 0
35153520
var 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('&gt;') > 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('>', '&gt;') : false
5483+
5484+
// #3663
5485+
// IE encodes newlines inside attribute values while other browsers don't
5486+
var shouldDecodeNewlines = inBrowser ? shouldDecode('\n', '&#10;') : false
5487+
5488+
/* */
5489+
54765490
var decoder = document.createElement('div')
54775491

54785492
function decodeHTML (html) {
@@ -5527,15 +5541,19 @@ var isSpecialTag = makeMap('script,style', true)
55275541

55285542
var reCache = {}
55295543

5530-
var ampRE = /&amp;/g
55315544
var ltRE = /&lt;/g
55325545
var gtRE = /&gt;/g
5546+
var nlRE = /&#10;/g
5547+
var ampRE = /&amp;/g
55335548
var quoteRE = /&quot;/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;

dist/vue.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)