File tree Expand file tree Collapse file tree 3 files changed +27
-4
lines changed
test/unit/specs/directives Expand file tree Collapse file tree 3 files changed +27
-4
lines changed Original file line number Diff line number Diff line change @@ -50,14 +50,14 @@ function enableDebug () {
50
50
if ( type === 'directive' ) {
51
51
if ( id === 'component' ) {
52
52
exports . warn (
53
- 'v-component has been deprecated in 0.12. ' +
54
- 'Use custom element syntax instead.'
53
+ 'v-component can only be used on table elements ' +
54
+ 'in ^0.12.0. Use custom element syntax instead.'
55
55
)
56
56
return
57
57
}
58
58
if ( id === 'with' ) {
59
59
exports . warn (
60
- 'v-with has been deprecated in 0.12. ' +
60
+ 'v-with has been deprecated in ^ 0.12.0 . ' +
61
61
'Use props instead.'
62
62
)
63
63
return
Original file line number Diff line number Diff line change 1
1
var _ = require ( './index' )
2
2
var config = require ( '../config' )
3
- var commonTagRE = / ^ ( d i v | p | s p a n | i m g | a | b r | u l | o l | l i | h 1 | h 2 | h 3 | h 4 | h 5 | t a b l e | t b o d y | t r | t d | p r e ) $ /
3
+ var commonTagRE = / ^ ( d i v | p | s p a n | i m g | a | b r | u l | o l | l i | h 1 | h 2 | h 3 | h 4 | h 5 | c o d e | p r e ) $ /
4
+ var tableElementsRE = / ^ c a p t i o n | c o l g r o u p | t h e a d | t f o o t | t b o d y | t r | t d | t h $ /
4
5
5
6
/**
6
7
* Check if an element is a component, if yes return its
@@ -23,6 +24,11 @@ exports.checkComponent = function (el, options) {
23
24
_ . resolveAsset ( options , 'components' , tag )
24
25
) {
25
26
return tag
27
+ } else if (
28
+ tableElementsRE . test ( tag ) &&
29
+ ( tag = _ . attr ( el , 'component' ) )
30
+ ) {
31
+ return tag
26
32
}
27
33
}
28
34
Original file line number Diff line number Diff line change @@ -48,6 +48,23 @@ if (_.inBrowser) {
48
48
expect ( el . innerHTML ) . toBe ( '<p>123</p>' )
49
49
} )
50
50
51
+ it ( 'allow v-component on table elements' , function ( ) {
52
+ var vm = new Vue ( {
53
+ el : el ,
54
+ template : '<table><tbody><tr v-component="test"></tr></tbody></table>' ,
55
+ components : {
56
+ test : {
57
+ data : function ( ) {
58
+ return { a : 123 }
59
+ } ,
60
+ template : '<td>{{a}}</td>'
61
+ }
62
+ }
63
+ } )
64
+ expect ( el . innerHTML ) . toBe ( vm . $options . template . replace ( / < t r .* \/ t r > / , '<tr><td>123</td></tr>' ) )
65
+ expect ( _ . warn ) . not . toHaveBeenCalled ( )
66
+ } )
67
+
51
68
it ( 'inline-template' , function ( ) {
52
69
var vm = new Vue ( {
53
70
el : el ,
You can’t perform that action at this time.
0 commit comments