Skip to content
This repository was archived by the owner on Jan 18, 2022. It is now read-only.

Commit 6768967

Browse files
committed
fix eslint warning
add test for deep and >>>
1 parent d1e0665 commit 6768967

File tree

5 files changed

+60
-3
lines changed

5 files changed

+60
-3
lines changed

src/style/css.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import debug from '../debug'
1111
* @param tag
1212
* @returns {boolean}
1313
*/
14-
function isInvalidTag( tag ) {
14+
function isInvalidTag (tag) {
1515
let isValid = false
1616

1717
if (tag === 'from' ||
@@ -37,15 +37,15 @@ const addScopeID = postcss.plugin('add-scope-id', options => {
3737

3838
if (n.type === 'tag') {
3939
if (n.value === '/deep/') {
40-
let next = n.next()
40+
const next = n.next()
4141

4242
if (next.type === 'combinator' && next.value === ' ') {
4343
next.remove()
4444
}
4545

4646
n.remove()
4747
return false
48-
} else if ( isInvalidTag( n.value ) ) {
48+
} else if (isInvalidTag(n.value)) {
4949
return
5050
}
5151
}
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
.test[data-v-00b08a60] a {
2+
color: red;
3+
}
4+
5+
.test[data-v-00b08a60] .text {
6+
background-color: red;
7+
}
8+
9+
@keyframes test {
10+
0% {
11+
color: red;
12+
}
13+
14+
50% {
15+
color: green;
16+
}
17+
18+
100% {
19+
color: yellow;
20+
}
21+
}
22+
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
var scopedCssWithDeepTag = { template: "<div class=\"test\">Foo</div>",_scopeId: 'data-v-00b08a60',};
2+
3+
export default scopedCssWithDeepTag;
+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<template>
2+
<div class="test">Foo</div>
3+
</template>
4+
5+
<script lang="babel">
6+
export default {}
7+
</script>
8+
9+
<style lang="css" scoped>
10+
.test /deep/ a {
11+
color: red;
12+
}
13+
14+
.test >>> .text {
15+
background-color: red;
16+
}
17+
18+
@keyframes test {
19+
0% {
20+
color: red;
21+
}
22+
23+
50% {
24+
color: green;
25+
}
26+
27+
100% {
28+
color: yellow;
29+
}
30+
}
31+
</style>

test/test.js

+1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ function test(name) {
5757
'pug',
5858
'scoped-css',
5959
'scoped-css-with-no-auto-style',
60+
'scoped-css-with-deep-tag',
6061
'scss',
6162
'sass',
6263
'pug',

0 commit comments

Comments
 (0)