|
|
@@ -1,5 +1,5 @@
|
|
|
/*!
|
|
|
- * Vue.js v1.0.10
|
|
|
+ * Vue.js v1.0.11
|
|
|
* (c) 2015 Evan You
|
|
|
* Released under the MIT License.
|
|
|
*/
|
|
|
@@ -33,6 +33,7 @@
|
|
|
vm._digest();
|
|
|
}
|
|
|
}
|
|
|
+ return val;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -564,6 +565,7 @@
|
|
|
var str;
|
|
|
var dir;
|
|
|
var c;
|
|
|
+ var prev;
|
|
|
var i;
|
|
|
var l;
|
|
|
var lastFilterIndex;
|
|
|
@@ -649,13 +651,14 @@
|
|
|
dir = {};
|
|
|
|
|
|
for (i = 0, l = str.length; i < l; i++) {
|
|
|
+ prev = c;
|
|
|
c = str.charCodeAt(i);
|
|
|
if (inSingle) {
|
|
|
// check single quote
|
|
|
- if (c === 0x27) inSingle = !inSingle;
|
|
|
+ if (c === 0x27 && prev !== 0x5C) inSingle = !inSingle;
|
|
|
} else if (inDouble) {
|
|
|
// check double quote
|
|
|
- if (c === 0x22) inDouble = !inDouble;
|
|
|
+ if (c === 0x22 && prev !== 0x5C) inDouble = !inDouble;
|
|
|
} else if (c === 0x7C && // pipe
|
|
|
str.charCodeAt(i + 1) !== 0x7C && str.charCodeAt(i - 1) !== 0x7C) {
|
|
|
if (dir.expression == null) {
|
|
|
@@ -848,10 +851,22 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Replace all interpolation tags in a piece of text.
|
|
|
+ *
|
|
|
+ * @param {String} text
|
|
|
+ * @return {String}
|
|
|
+ */
|
|
|
+
|
|
|
+ function removeTags(text) {
|
|
|
+ return text.replace(tagRE, '');
|
|
|
+ }
|
|
|
+
|
|
|
var text$1 = Object.freeze({
|
|
|
compileRegex: compileRegex,
|
|
|
parseText: parseText,
|
|
|
- tokensToExp: tokensToExp
|
|
|
+ tokensToExp: tokensToExp,
|
|
|
+ removeTags: removeTags
|
|
|
});
|
|
|
|
|
|
var delimiters = ['{{', '}}'];
|
|
|
@@ -1125,6 +1140,18 @@
|
|
|
return val;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Check the presence of a bind attribute.
|
|
|
+ *
|
|
|
+ * @param {Node} node
|
|
|
+ * @param {String} name
|
|
|
+ * @return {Boolean}
|
|
|
+ */
|
|
|
+
|
|
|
+ function hasBindAttr(node, name) {
|
|
|
+ return node.hasAttribute(name) || node.hasAttribute(':' + name) || node.hasAttribute('v-bind:' + name);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Insert el before target
|
|
|
*
|
|
|
@@ -1214,11 +1241,30 @@
|
|
|
el.removeEventListener(event, cb);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * In IE9, setAttribute('class') will result in empty class
|
|
|
+ * if the element also has the :class attribute; However in
|
|
|
+ * PhantomJS, setting `className` does not work on SVG elements...
|
|
|
+ * So we have to do a conditional check here.
|
|
|
+ *
|
|
|
+ * @param {Element} el
|
|
|
+ * @param {String} cls
|
|
|
+ */
|
|
|
+
|
|
|
+ function setClass(el, cls) {
|
|
|
+ /* istanbul ignore if */
|
|
|
+ if (isIE9 && el.hasOwnProperty('className')) {
|
|
|
+ el.className = cls;
|
|
|
+ } else {
|
|
|
+ el.setAttribute('class', cls);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Add class with compatibility for IE & SVG
|
|
|
*
|
|
|
* @param {Element} el
|
|
|
- * @param {Strong} cls
|
|
|
+ * @param {String} cls
|
|
|
*/
|
|
|
|
|
|
function addClass(el, cls) {
|
|
|
@@ -1227,7 +1273,7 @@
|
|
|
} else {
|
|
|
var cur = ' ' + (el.getAttribute('class') || '') + ' ';
|
|
|
if (cur.indexOf(' ' + cls + ' ') < 0) {
|
|
|
- el.setAttribute('class', (cur + cls).trim());
|
|
|
+ setClass(el, (cur + cls).trim());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -1236,7 +1282,7 @@
|
|
|
* Remove class with compatibility for IE & SVG
|
|
|
*
|
|
|
* @param {Element} el
|
|
|
- * @param {Strong} cls
|
|
|
+ * @param {String} cls
|
|
|
*/
|
|
|
|
|
|
function removeClass(el, cls) {
|
|
|
@@ -1248,7 +1294,7 @@
|
|
|
while (cur.indexOf(tar) >= 0) {
|
|
|
cur = cur.replace(tar, ' ');
|
|
|
}
|
|
|
- el.setAttribute('class', cur.trim());
|
|
|
+ setClass(el, cur.trim());
|
|
|
}
|
|
|
if (!el.className) {
|
|
|
el.removeAttribute('class');
|
|
|
@@ -2122,7 +2168,7 @@
|
|
|
var ob;
|
|
|
if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
|
|
|
ob = value.__ob__;
|
|
|
- } else if ((isArray(value) || isPlainObject(value)) && !Object.isFrozen(value) && !value._isVue) {
|
|
|
+ } else if ((isArray(value) || isPlainObject(value)) && Object.isExtensible(value) && !value._isVue) {
|
|
|
ob = new Observer(value);
|
|
|
}
|
|
|
if (ob && vm) {
|
|
|
@@ -2227,6 +2273,7 @@
|
|
|
inDoc: inDoc,
|
|
|
getAttr: getAttr,
|
|
|
getBindAttr: getBindAttr,
|
|
|
+ hasBindAttr: hasBindAttr,
|
|
|
before: before,
|
|
|
after: after,
|
|
|
remove: remove,
|
|
|
@@ -2700,11 +2747,11 @@
|
|
|
|
|
|
var wsRE = /\s/g;
|
|
|
var newlineRE = /\n/g;
|
|
|
- var saveRE = /[\{,]\s*[\w\$_]+\s*:|('[^']*'|"[^"]*")|new |typeof |void /g;
|
|
|
+ var saveRE = /[\{,]\s*[\w\$_]+\s*:|('(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*")|new |typeof |void /g;
|
|
|
var restoreRE = /"(\d+)"/g;
|
|
|
- var pathTestRE = /^[A-Za-z_$][\w$]*(\.[A-Za-z_$][\w$]*|\['.*?'\]|\[".*?"\]|\[\d+\]|\[[A-Za-z_$][\w$]*\])*$/;
|
|
|
- var pathReplaceRE = /[^\w$\.]([A-Za-z_$][\w$]*(\.[A-Za-z_$][\w$]*|\['.*?'\]|\[".*?"\])*)/g;
|
|
|
- var booleanLiteralRE = /^(true|false)$/;
|
|
|
+ var pathTestRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['.*?'\]|\[".*?"\]|\[\d+\]|\[[A-Za-z_$][\w$]*\])*$/;
|
|
|
+ var identRE = /[^\w$\.](?:[A-Za-z_$][\w$]*)/g;
|
|
|
+ var booleanLiteralRE = /^(?:true|false)$/;
|
|
|
|
|
|
/**
|
|
|
* Save / Rewrite / Restore
|
|
|
@@ -2787,7 +2834,7 @@
|
|
|
var body = exp.replace(saveRE, save).replace(wsRE, '');
|
|
|
// rewrite all paths
|
|
|
// pad 1 space here becaue the regex matches 1 extra char
|
|
|
- body = (' ' + body).replace(pathReplaceRE, rewrite).replace(restoreRE, restore);
|
|
|
+ body = (' ' + body).replace(identRE, rewrite).replace(restoreRE, restore);
|
|
|
return makeGetterFn(body);
|
|
|
}
|
|
|
|
|
|
@@ -3681,7 +3728,7 @@
|
|
|
};
|
|
|
|
|
|
this.on('change', this.listener);
|
|
|
- if (el.checked) {
|
|
|
+ if (el.hasAttribute('checked')) {
|
|
|
this.afterBind = this.listener;
|
|
|
}
|
|
|
},
|
|
|
@@ -3827,7 +3874,7 @@
|
|
|
};
|
|
|
this.on('change', this.listener);
|
|
|
|
|
|
- if (el.checked) {
|
|
|
+ if (el.hasAttribute('checked')) {
|
|
|
this.afterBind = this.listener;
|
|
|
}
|
|
|
},
|
|
|
@@ -5790,6 +5837,9 @@
|
|
|
if (activateHook && !cached) {
|
|
|
this.waitingFor = newComponent;
|
|
|
activateHook.call(newComponent, function () {
|
|
|
+ if (self.waitingFor !== newComponent) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
self.waitingFor = null;
|
|
|
self.transition(newComponent, cb);
|
|
|
});
|
|
|
@@ -6074,7 +6124,7 @@
|
|
|
var empty = {};
|
|
|
|
|
|
// regexes
|
|
|
- var identRE = /^[$_a-zA-Z]+[\w$]*$/;
|
|
|
+ var identRE$1 = /^[$_a-zA-Z]+[\w$]*$/;
|
|
|
var settablePathRE = /^[A-Za-z_$][\w$]*(\.[A-Za-z_$][\w$]*|\[[^\[\]]+\])*$/;
|
|
|
|
|
|
/**
|
|
|
@@ -6104,7 +6154,7 @@
|
|
|
// interpreted as minus calculations by the parser
|
|
|
// so we need to camelize the path here
|
|
|
path = camelize(name);
|
|
|
- if (!identRE.test(path)) {
|
|
|
+ if (!identRE$1.test(path)) {
|
|
|
'development' !== 'production' && warn('Invalid prop key: "' + name + '". Prop keys ' + 'must be valid identifiers.');
|
|
|
continue;
|
|
|
}
|
|
|
@@ -6712,6 +6762,11 @@
|
|
|
function checkElementDirectives(el, options) {
|
|
|
var tag = el.tagName.toLowerCase();
|
|
|
if (commonTagRE.test(tag)) return;
|
|
|
+ // special case: give named slot a higher priority
|
|
|
+ // than unnamed slots
|
|
|
+ if (tag === 'slot' && hasBindAttr(el, 'name')) {
|
|
|
+ tag = '_namedSlot';
|
|
|
+ }
|
|
|
var def = resolveAsset(options, 'elementDirectives', tag);
|
|
|
if (def) {
|
|
|
return makeTerminalNodeLinkFn(el, tag, '', options, def);
|
|
|
@@ -6850,8 +6905,12 @@
|
|
|
// attribute interpolations
|
|
|
if (tokens) {
|
|
|
value = tokensToExp(tokens);
|
|
|
- arg = name;
|
|
|
- pushDir('bind', publicDirectives.bind, true);
|
|
|
+ if (name === 'class') {
|
|
|
+ pushDir('class', internalDirectives['class'], true);
|
|
|
+ } else {
|
|
|
+ arg = name;
|
|
|
+ pushDir('bind', publicDirectives.bind, true);
|
|
|
+ }
|
|
|
// warn against mixing mustaches with v-bind
|
|
|
if ('development' !== 'production') {
|
|
|
if (name === 'class' && Array.prototype.some.call(attrs, function (attr) {
|
|
|
@@ -7052,7 +7111,7 @@
|
|
|
// non-element template
|
|
|
replacer.nodeType !== 1 ||
|
|
|
// single nested component
|
|
|
- tag === 'component' || resolveAsset(options, 'components', tag) || replacer.hasAttribute('is') || replacer.hasAttribute(':is') || replacer.hasAttribute('v-bind:is') ||
|
|
|
+ tag === 'component' || resolveAsset(options, 'components', tag) || hasBindAttr(replacer, 'is') ||
|
|
|
// element directive
|
|
|
resolveAsset(options, 'elementDirectives', tag) ||
|
|
|
// for block
|
|
|
@@ -7588,7 +7647,13 @@
|
|
|
// remove attribute
|
|
|
if ((name !== 'cloak' || this.vm._isCompiled) && this.el && this.el.removeAttribute) {
|
|
|
var attr = descriptor.attr || 'v-' + name;
|
|
|
- this.el.removeAttribute(attr);
|
|
|
+ if (attr !== 'class') {
|
|
|
+ this.el.removeAttribute(attr);
|
|
|
+ } else {
|
|
|
+ // for class interpolations, only remove the parts that
|
|
|
+ // need to be interpolated.
|
|
|
+ this.el.className = removeTags(this.el.className).trim().replace(/\s+/g, ' ');
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// copy def properties
|
|
|
@@ -7959,6 +8024,30 @@
|
|
|
}
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
+ var destroyReady;
|
|
|
+ var pendingRemoval;
|
|
|
+
|
|
|
+ var self = this;
|
|
|
+ // Cleanup should be called either synchronously or asynchronoysly as
|
|
|
+ // callback of this.$remove(), or if remove and deferCleanup are false.
|
|
|
+ // In any case it should be called after all other removing, unbinding and
|
|
|
+ // turning of is done
|
|
|
+ var cleanupIfPossible = function cleanupIfPossible() {
|
|
|
+ if (destroyReady && !pendingRemoval && !deferCleanup) {
|
|
|
+ self._cleanup();
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ // remove DOM element
|
|
|
+ if (remove && this.$el) {
|
|
|
+ pendingRemoval = true;
|
|
|
+ this.$remove(function () {
|
|
|
+ pendingRemoval = false;
|
|
|
+ cleanupIfPossible();
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
this._callHook('beforeDestroy');
|
|
|
this._isBeingDestroyed = true;
|
|
|
var i;
|
|
|
@@ -7992,15 +8081,9 @@
|
|
|
if (this.$el) {
|
|
|
this.$el.__vue__ = null;
|
|
|
}
|
|
|
- // remove DOM element
|
|
|
- var self = this;
|
|
|
- if (remove && this.$el) {
|
|
|
- this.$remove(function () {
|
|
|
- self._cleanup();
|
|
|
- });
|
|
|
- } else if (!deferCleanup) {
|
|
|
- this._cleanup();
|
|
|
- }
|
|
|
+
|
|
|
+ destroyReady = true;
|
|
|
+ cleanupIfPossible();
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
@@ -8181,6 +8264,12 @@
|
|
|
return extendOptions._Ctor;
|
|
|
}
|
|
|
var name = extendOptions.name || Super.options.name;
|
|
|
+ if ('development' !== 'production') {
|
|
|
+ if (!/^[a-zA-Z][\w-]+$/.test(name)) {
|
|
|
+ warn('Invalid component name: ' + name);
|
|
|
+ name = null;
|
|
|
+ }
|
|
|
+ }
|
|
|
var Sub = createClass(name || 'VueComponent');
|
|
|
Sub.prototype = Object.create(Super.prototype);
|
|
|
Sub.prototype.constructor = Sub;
|
|
|
@@ -8298,7 +8387,9 @@
|
|
|
if (asStatement && !isSimplePath(exp)) {
|
|
|
var self = this;
|
|
|
return function statementHandler() {
|
|
|
+ self.$arguments = toArray(arguments);
|
|
|
res.get.call(self, self);
|
|
|
+ self.$arguments = null;
|
|
|
};
|
|
|
} else {
|
|
|
try {
|
|
|
@@ -8355,6 +8446,7 @@
|
|
|
}
|
|
|
var watcher = new Watcher(vm, expOrFn, cb, {
|
|
|
deep: options && options.deep,
|
|
|
+ sync: options && options.sync,
|
|
|
filters: parsed && parsed.filters
|
|
|
});
|
|
|
if (options && options.immediate) {
|
|
|
@@ -9162,55 +9254,46 @@
|
|
|
// instance being stored as `$options._content` during
|
|
|
// the transclude phase.
|
|
|
|
|
|
+ // We are exporting two versions, one for named and one
|
|
|
+ // for unnamed, because the unnamed slots must be compiled
|
|
|
+ // AFTER all named slots have selected their content. So
|
|
|
+ // we need to give them different priorities in the compilation
|
|
|
+ // process. (See #1965)
|
|
|
+
|
|
|
var slot = {
|
|
|
|
|
|
priority: 1750,
|
|
|
|
|
|
- params: ['name'],
|
|
|
-
|
|
|
bind: function bind() {
|
|
|
var host = this.vm;
|
|
|
var raw = host.$options._content;
|
|
|
- var content;
|
|
|
if (!raw) {
|
|
|
this.fallback();
|
|
|
return;
|
|
|
}
|
|
|
var context = host._context;
|
|
|
- var slotName = this.params.name;
|
|
|
+ var slotName = this.params && this.params.name;
|
|
|
if (!slotName) {
|
|
|
- // Default content
|
|
|
- var self = this;
|
|
|
- var compileDefaultContent = function compileDefaultContent() {
|
|
|
- self.compile(extractFragment(raw.childNodes, raw, true), context, host);
|
|
|
- };
|
|
|
- if (!host._isCompiled) {
|
|
|
- // defer until the end of instance compilation,
|
|
|
- // because the default outlet must wait until all
|
|
|
- // other possible outlets with selectors have picked
|
|
|
- // out their contents.
|
|
|
- host.$once('hook:compiled', compileDefaultContent);
|
|
|
- } else {
|
|
|
- compileDefaultContent();
|
|
|
- }
|
|
|
+ // Default slot
|
|
|
+ this.tryCompile(extractFragment(raw.childNodes, raw, true), context, host);
|
|
|
} else {
|
|
|
+ // Named slot
|
|
|
var selector = '[slot="' + slotName + '"]';
|
|
|
var nodes = raw.querySelectorAll(selector);
|
|
|
if (nodes.length) {
|
|
|
- content = extractFragment(nodes, raw);
|
|
|
- if (content.hasChildNodes()) {
|
|
|
- this.compile(content, context, host);
|
|
|
- } else {
|
|
|
- this.fallback();
|
|
|
- }
|
|
|
+ this.tryCompile(extractFragment(nodes, raw), context, host);
|
|
|
} else {
|
|
|
this.fallback();
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
|
|
|
- fallback: function fallback() {
|
|
|
- this.compile(extractContent(this.el, true), this.vm);
|
|
|
+ tryCompile: function tryCompile(content, context, host) {
|
|
|
+ if (content.hasChildNodes()) {
|
|
|
+ this.compile(content, context, host);
|
|
|
+ } else {
|
|
|
+ this.fallback();
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
compile: function compile(content, context, host) {
|
|
|
@@ -9225,6 +9308,10 @@
|
|
|
}
|
|
|
},
|
|
|
|
|
|
+ fallback: function fallback() {
|
|
|
+ this.compile(extractContent(this.el, true), this.vm);
|
|
|
+ },
|
|
|
+
|
|
|
unbind: function unbind() {
|
|
|
if (this.unlink) {
|
|
|
this.unlink();
|
|
|
@@ -9232,6 +9319,11 @@
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+ var namedSlot = extend(extend({}, slot), {
|
|
|
+ priority: slot.priority + 1,
|
|
|
+ params: ['name']
|
|
|
+ });
|
|
|
+
|
|
|
/**
|
|
|
* Extract qualified content nodes from a node list.
|
|
|
*
|
|
|
@@ -9271,10 +9363,11 @@
|
|
|
|
|
|
var elementDirectives = {
|
|
|
slot: slot,
|
|
|
+ _namedSlot: namedSlot, // same as slot but with higher priority
|
|
|
partial: partial
|
|
|
};
|
|
|
|
|
|
- Vue.version = '1.0.10';
|
|
|
+ Vue.version = '1.0.11';
|
|
|
|
|
|
/**
|
|
|
* Vue and every constructor that extends Vue has an
|
|
|
@@ -9297,9 +9390,11 @@
|
|
|
|
|
|
// devtools global hook
|
|
|
/* istanbul ignore if */
|
|
|
- if ('development' !== 'production') {
|
|
|
- if (inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__) {
|
|
|
+ if ('development' !== 'production' && inBrowser) {
|
|
|
+ if (window.__VUE_DEVTOOLS_GLOBAL_HOOK__) {
|
|
|
window.__VUE_DEVTOOLS_GLOBAL_HOOK__.emit('init', Vue);
|
|
|
+ } else if (/Chrome\/\d+/.test(navigator.userAgent)) {
|
|
|
+ console.log('Download the Vue Devtools for a better development experience:\n' + 'https://github.com/vuejs/vue-devtools');
|
|
|
}
|
|
|
}
|
|
|
|