Skip to content

Commit 1c166b7

Browse files
committed
do not remove slot attribute (close #1281)
1 parent 7507fb7 commit 1c166b7

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

src/element-directives/slot.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,6 @@ function extractFragment (nodes, parent, main) {
135135
node = templateParser.parse(node)
136136
}
137137
node = templateParser.clone(node)
138-
if (node.attributes) {
139-
node.removeAttribute('slot')
140-
}
141138
frag.appendChild(node)
142139
}
143140
}

test/unit/specs/element-directives/slot_spec.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ describe('Slot Distribution', function () {
6060
el.innerHTML = '<p slot="t">1</p><div></div><p slot="t">2</p>'
6161
options.template = '<slot name="t"></slot>'
6262
mount()
63-
expect(el.innerHTML).toBe('<p>1</p><p>2</p>')
63+
expect(el.innerHTML).toBe('<p slot="t">1</p><p slot="t">2</p>')
6464
})
6565

6666
it('default content should only render parts not selected', function () {
@@ -70,7 +70,7 @@ describe('Slot Distribution', function () {
7070
'<slot></slot>' +
7171
'<slot name="b"></slot>'
7272
mount()
73-
expect(el.innerHTML).toBe('<p>1</p><div>hi</div><p>2</p>')
73+
expect(el.innerHTML).toBe('<p slot="a">1</p><div>hi</div><p slot="b">2</p>')
7474
})
7575

7676
it('content transclusion with replace', function () {
@@ -126,7 +126,7 @@ describe('Slot Distribution', function () {
126126
theName: 'two'
127127
}
128128
mount()
129-
expect(el.innerHTML).toBe('<p>two</p>')
129+
expect(el.innerHTML).toBe('<p slot="two">two</p>')
130130
})
131131

132132
it('content should be dynamic and compiled in parent scope', function (done) {
@@ -194,7 +194,7 @@ describe('Slot Distribution', function () {
194194
this.list = this.$options._content.querySelectorAll('p').length
195195
}
196196
})
197-
expect(el.innerHTML).toBe('<div><p>1</p></div><div><p>2</p></div><div><p>3</p></div>')
197+
expect(el.innerHTML).toBe('<div><p slot="1">1</p></div><div><p slot="2">2</p></div><div><p slot="3">3</p></div>')
198198
})
199199

200200
it('v-repeat + component + parent directive + transclusion', function (done) {

0 commit comments

Comments
 (0)