Skip to content

templates as a function #4046

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 30 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
443ef1c
Update CONTRIBUTING.md's jdfiddle template, and vue's version inside …
fnlctrl Oct 12, 2016
a9417e4
select change event fix (#3922)
defcc Oct 12, 2016
7ca58b6
small tweak
yyx990803 Oct 12, 2016
ceab0b7
fix functional components that return string or nothing (fix #3919)
yyx990803 Oct 12, 2016
e774ce2
refactor: split vdom helpers into separate files
yyx990803 Oct 12, 2016
5d0999a
ensure v-model runtime metadata for all types
yyx990803 Oct 12, 2016
ea39d9f
fix static node v-for nested check
yyx990803 Oct 12, 2016
6ab10c0
fix v-for list auto-keying with nested <template> (fix #3913)
yyx990803 Oct 12, 2016
6e96a65
adjust component destroy logic (really fix #3882)
yyx990803 Oct 12, 2016
8823fcc
expose preserveWhitespace option in template compiler
yyx990803 Oct 13, 2016
ff178cc
fix directive rawName generation for raw render functions (fix #3930)
yyx990803 Oct 13, 2016
30bd34e
disable duplicate attribute warning in IE (close #3929)
yyx990803 Oct 13, 2016
a675221
should not generate children for "is" component with inline-template …
yyx990803 Oct 13, 2016
d362d64
update entities encoding/decoding (fix #3899)
yyx990803 Oct 13, 2016
3f8fa43
fix duplicate attribute test case in IE
yyx990803 Oct 13, 2016
1e6a8f5
[build] 2.0.3
yyx990803 Oct 13, 2016
3bbac7e
[release] 2.0.3
yyx990803 Oct 13, 2016
95bf0c0
Add guide for PR title (#3936)
defcc Oct 14, 2016
4f5a47d
fix root v-else not rendering in prod and switched examples to minifi…
chrisvfritz Oct 14, 2016
8ba420c
Fix using one delay to control all transitions. (#3932)
guidobouman Oct 17, 2016
341d0a0
fixed #3942 (#3947)
Oct 17, 2016
7c9575b
improve attr interpolation warning
yyx990803 Oct 17, 2016
6d31ed2
typo fix (#3963)
javoski Oct 17, 2016
1a8720d
Fix typo in 'component' (#3978)
AlexandreBonneau Oct 19, 2016
9c91190
Fix typos. (#3956)
bringtree Oct 19, 2016
5f8ae40
minor typos (#4011)
shreeve Oct 22, 2016
3105661
v-model binding with array. (fix #3958,#3979) (#3988)
defcc Oct 22, 2016
7dc38de
fix SFC parsing pug templates that contains "<" (fix #3973)
yyx990803 Oct 22, 2016
defd45c
Typo fix: optimizier -> optimizer (#4015)
bmax Oct 24, 2016
0d35aa5
Fix links on vue-template-compiler README (#4021)
posva Oct 24, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Hi! I’m really excited that you are interested in contributing to Vue.js. Befo

- It is **required** that you clearly describe the steps necessary to reproduce the issue you are running into. Issues with no clear repro steps will not be triaged. If an issue labeled "need repro" receives no further input from the issue author for more than 5 days, it will be closed.

- It is recommended that you make a JSFiddle/JSBin/Codepen to demonstrate your issue. You could start with [this template](http://jsfiddle.net/5sH6A/) that already includes the latest version of Vue.
- It is recommended that you make a JSFiddle/JSBin/Codepen to demonstrate your issue. You could start with [this template](http://jsfiddle.net/df4Lnuw6/) that already includes the latest version of Vue.

- For bugs that involves build setups, you can create a reproduction repository with steps in the README.

Expand All @@ -45,6 +45,7 @@ Hi! I’m really excited that you are interested in contributing to Vue.js. Befo
- Provide convincing reason to add this feature. Ideally you should open a suggestion issue first and have it greenlighted before working on it.

- If fixing a bug:
- If you are resolving a special issue, add `(fix #xxxx[,#xxx])` (#xxxx is the issue id) in your PR title for a better release log, e.g. `update entities encoding/decoding (fix #3899)`.
- Provide detailed description of the bug in the PR. Live demo preferred.
- Add appropriate test coverage if applicable.

Expand Down
3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@ Remove the template from below and provide thoughtful commentary *and code sampl

<!-- BUG REPORT TEMPLATE -->
### Vue.js version
2.0.0-rc.1
2.0.2

### Reproduction Link
<!-- A minimal JSBin, JSFiddle, Codepen, or a GitHub repository that can reproduce the bug. -->
<!-- You could start with this template: http://jsfiddle.net/df4Lnuw6/ -->

### Steps to reproduce

Expand Down
10 changes: 5 additions & 5 deletions build/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ const builds = {
env: 'production',
banner
},
// Runtime+compiler standalone developement build.
// Runtime+compiler standalone development build.
'web-standalone-dev': {
entry: path.resolve(__dirname, '../src/entries/web-runtime-with-compiler.js'),
dest: path.resolve(__dirname, '../dist/vue.js'),
format: 'umd',
env: 'development',
banner,
alias: {
entities: './entity-decoder'
he: './entity-decoder'
}
},
// Runtime+compiler standalone production build.
Expand All @@ -49,22 +49,22 @@ const builds = {
env: 'production',
banner,
alias: {
entities: './entity-decoder'
he: './entity-decoder'
}
},
// Web compiler (CommonJS).
'web-compiler': {
entry: path.resolve(__dirname, '../src/entries/web-compiler.js'),
dest: path.resolve(__dirname, '../packages/vue-template-compiler/build.js'),
format: 'cjs',
external: ['entities', 'de-indent']
external: ['he', 'de-indent']
},
// Web server renderer (CommonJS).
'web-server-renderer': {
entry: path.resolve(__dirname, '../src/entries/web-server-renderer.js'),
dest: path.resolve(__dirname, '../packages/vue-server-renderer/build.js'),
format: 'cjs',
external: ['stream', 'module', 'vm', 'entities', 'de-indent']
external: ['stream', 'module', 'vm', 'he', 'de-indent']
}
}

Expand Down
182 changes: 94 additions & 88 deletions dist/vue.common.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Vue.js v2.0.2
* Vue.js v2.0.3
* (c) 2014-2016 Evan You
* Released under the MIT License.
*/
Expand Down Expand Up @@ -1481,85 +1481,25 @@ function cloneVNodes (vnodes) {

/* */

function normalizeChildren (
children,
ns,
nestedIndex
) {
if (isPrimitive(children)) {
return [createTextVNode(children)]
}
if (Array.isArray(children)) {
var res = [];
for (var i = 0, l = children.length; i < l; i++) {
var c = children[i];
var last = res[res.length - 1];
// nested
if (Array.isArray(c)) {
res.push.apply(res, normalizeChildren(c, ns, i));
} else if (isPrimitive(c)) {
if (last && last.text) {
last.text += String(c);
} else if (c !== '') {
// convert primitive to vnode
res.push(createTextVNode(c));
}
} else if (c instanceof VNode) {
if (c.text && last && last.text) {
last.text += c.text;
} else {
// inherit parent namespace
if (ns) {
applyNS(c, ns);
}
// default key for nested array children (likely generated by v-for)
if (c.tag && c.key == null && nestedIndex != null) {
c.key = "__vlist_" + nestedIndex + "_" + i + "__";
}
res.push(c);
}
}
}
return res
}
}

function createTextVNode (val) {
return new VNode(undefined, undefined, undefined, String(val))
}

function applyNS (vnode, ns) {
if (vnode.tag && !vnode.ns) {
vnode.ns = ns;
if (vnode.children) {
for (var i = 0, l = vnode.children.length; i < l; i++) {
applyNS(vnode.children[i], ns);
}
}
}
}

function getFirstComponentChild (children) {
return children && children.filter(function (c) { return c && c.componentOptions; })[0]
}

function mergeVNodeHook (def$$1, hookKey, hook, key) {
function mergeVNodeHook (def, hookKey, hook, key) {
key = key + hookKey;
var injectedHash = def$$1.__injected || (def$$1.__injected = {});
var injectedHash = def.__injected || (def.__injected = {});
if (!injectedHash[key]) {
injectedHash[key] = true;
var oldHook = def$$1[hookKey];
var oldHook = def[hookKey];
if (oldHook) {
def$$1[hookKey] = function () {
def[hookKey] = function () {
oldHook.apply(this, arguments);
hook.apply(this, arguments);
};
} else {
def$$1[hookKey] = hook;
def[hookKey] = hook;
}
}
}

/* */

function updateListeners (
on,
oldOn,
Expand Down Expand Up @@ -1629,6 +1569,72 @@ function fnInvoker (o) {

/* */

function normalizeChildren (
children,
ns,
nestedIndex
) {
if (isPrimitive(children)) {
return [createTextVNode(children)]
}
if (Array.isArray(children)) {
var res = [];
for (var i = 0, l = children.length; i < l; i++) {
var c = children[i];
var last = res[res.length - 1];
// nested
if (Array.isArray(c)) {
res.push.apply(res, normalizeChildren(c, ns, ((nestedIndex || '') + "_" + i)));
} else if (isPrimitive(c)) {
if (last && last.text) {
last.text += String(c);
} else if (c !== '') {
// convert primitive to vnode
res.push(createTextVNode(c));
}
} else if (c instanceof VNode) {
if (c.text && last && last.text) {
last.text += c.text;
} else {
// inherit parent namespace
if (ns) {
applyNS(c, ns);
}
// default key for nested array children (likely generated by v-for)
if (c.tag && c.key == null && nestedIndex != null) {
c.key = "__vlist" + nestedIndex + "_" + i + "__";
}
res.push(c);
}
}
}
return res
}
}

function createTextVNode (val) {
return new VNode(undefined, undefined, undefined, String(val))
}

function applyNS (vnode, ns) {
if (vnode.tag && !vnode.ns) {
vnode.ns = ns;
if (vnode.children) {
for (var i = 0, l = vnode.children.length; i < l; i++) {
applyNS(vnode.children[i], ns);
}
}
}
}

/* */

function getFirstComponentChild (children) {
return children && children.filter(function (c) { return c && c.componentOptions; })[0]
}

/* */

var activeInstance = null;

function initLifecycle (vm) {
Expand Down Expand Up @@ -1810,6 +1816,8 @@ function lifecycleMixin (Vue) {
if (vm.$el) {
vm.$el.__vue__ = null;
}
// invoke destroy hooks on current rendered tree
vm.__patch__(vm._vnode, null);
};
}

Expand Down Expand Up @@ -1930,9 +1938,11 @@ function createFunctionalComponent (
slots: function () { return resolveSlots(children, context); }
}
);
vnode.functionalContext = context;
if (data.slot) {
(vnode.data || (vnode.data = {})).slot = data.slot;
if (vnode instanceof VNode) {
vnode.functionalContext = context;
if (data.slot) {
(vnode.data || (vnode.data = {})).slot = data.slot;
}
}
return vnode
}
Expand Down Expand Up @@ -3370,7 +3380,7 @@ Object.defineProperty(Vue$2.prototype, '$isServer', {
get: function () { return config._isServer; }
});

Vue$2.version = '2.0.2';
Vue$2.version = '2.0.3';

/* */

Expand Down Expand Up @@ -3928,12 +3938,6 @@ function createPatchFunction (backend) {
if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
}
if (isDef(i = vnode.child) && (
!data.keepAlive ||
vnode.context._isBeingDestroyed
)) {
invokeDestroyHook(i._vnode);
}
if (isDef(i = vnode.children)) {
for (j = 0; j < vnode.children.length; ++j) {
invokeDestroyHook(vnode.children[j]);
Expand Down Expand Up @@ -4185,6 +4189,11 @@ function createPatchFunction (backend) {
}

return function patch (oldVnode, vnode, hydrating, removeOnly) {
if (!vnode) {
if (oldVnode) { invokeDestroyHook(oldVnode); }
return
}

var elm, parent;
var isInitialPatch = false;
var insertedVnodeQueue = [];
Expand Down Expand Up @@ -4342,23 +4351,17 @@ function normalizeDirectives$1 (
var i, dir;
for (i = 0; i < dirs.length; i++) {
dir = dirs[i];
res[getRawDirName(dir)] = dir;
if (!dir.modifiers) {
dir.modifiers = emptyModifiers;
}
res[getRawDirName(dir)] = dir;
dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
}
return res
}

function getRawDirName (dir) {
return dir.rawName || (
dir.name + (
dir.modifiers
? '.' + Object.keys(dir.modifiers).join('.')
: ''
)
)
return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
}

function callHook$1 (dir, hook, vnode, oldVnode) {
Expand Down Expand Up @@ -5098,7 +5101,10 @@ var model = {
if (isIE || isEdge) {
setTimeout(cb, 0);
}
} else if (vnode.tag === 'textarea' || el.type === 'text') {
} else if (
(vnode.tag === 'textarea' || el.type === 'text') &&
!binding.modifiers.lazy
) {
if (!isAndroid) {
el.addEventListener('compositionstart', onCompositionStart);
el.addEventListener('compositionend', onCompositionEnd);
Expand All @@ -5118,7 +5124,7 @@ var model = {
// option in the DOM.
var needReset = el.multiple
? binding.value.some(function (v) { return hasNoMatchingOption(v, el.options); })
: hasNoMatchingOption(binding.value, el.options);
: binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, el.options);
if (needReset) {
trigger(el, 'change');
}
Expand Down
Loading