Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: vuejs/vue
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: dev
Choose a base ref
...
head repository: Tucora/vue
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: dev
Choose a head ref

There isn’t anything to compare.

vuejs:dev and Tucora:dev are entirely different commit histories.

Showing with 23 additions and 15 deletions.
  1. +11 −10 src/compiler/compile.js
  2. +4 −2 test/unit/lib/util.js
  3. +8 −3 test/unit/specs/compiler/compile_spec.js
21 changes: 11 additions & 10 deletions src/compiler/compile.js
Original file line number Diff line number Diff line change
@@ -208,16 +208,17 @@ exports.compileRoot = function (el, options, contextOptions) {
}
} else if (process.env.NODE_ENV !== 'production' && containerAttrs) {
// warn container directives for fragment instances
containerAttrs.forEach(function (attr) {
if (attr.name.indexOf('v-') === 0 || attr.name === 'transition') {
_.warn(
attr.name + ' is ignored on component ' +
'<' + options.el.tagName.toLowerCase() + '> because ' +
'the component is a fragment instance: ' +
'http://vuejs.org/guide/components.html#Fragment_Instance'
)
}
})
var names = containerAttrs.map(function (attr) {
return '"' + attr.name + '"'
}).join(', ')
var plural = containerAttrs.length > 1
_.warn(
'Attribute' + (plural ? 's ' : ' ') + names +
(plural ? ' are' : ' is') + ' ignored on component ' +
'<' + options.el.tagName.toLowerCase() + '> because ' +
'the component is a fragment instance: ' +
'http://vuejs.org/guide/components.html#Fragment_Instance'
)
}

return function rootLinkFn (vm, el, scope) {
6 changes: 4 additions & 2 deletions test/unit/lib/util.js
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ var scope = typeof window === 'undefined'
? global
: window

scope.hasWarned = function (_, msg) {
scope.hasWarned = function (_, msg, silent) {
var count = _.warn.calls.count()
while (count--) {
var args = _.warn.calls.argsFor(count)
@@ -11,7 +11,9 @@ scope.hasWarned = function (_, msg) {
}
}

console.warn('[test] "' + msg + '" was never warned.')
if (!silent) {
console.warn('[test] "' + msg + '" was never warned.')
}

function containsMsg (arg) {
return arg.indexOf(msg) > -1
11 changes: 8 additions & 3 deletions test/unit/specs/compiler/compile_spec.js
Original file line number Diff line number Diff line change
@@ -517,15 +517,20 @@ if (_.inBrowser) {
it('warn directives on fragment instances', function () {
new Vue({
el: el,
template: '<test v-show="ok"></test>',
template: '<test id="hi" class="ok" :prop="123"></test>',
components: {
test: {
replace: true,
template: '123'
props: ['prop'],
template: '{{prop}}'
}
}
})
expect(hasWarned(_, 'v-show is ignored on component <test>')).toBe(true)
expect(_.warn.calls.count()).toBe(1)
expect(
hasWarned(_, 'Attributes "id", "class" are ignored on component <test>', true) ||
hasWarned(_, 'Attributes "class", "id" are ignored on component <test>')
).toBe(true)
})

it('should compile component container directives using correct context', function () {