make CSS DCE case-insensitive - fixes #1269

pull/1314/head
Rich-Harris 7 years ago
parent 8717ff8c3c
commit ee01fb58c6

@ -167,7 +167,8 @@ function applySelector(blocks: Block[], node: Node, stack: Node[], toEncapsulate
} }
else if (selector.type === 'TypeSelector') { else if (selector.type === 'TypeSelector') {
if (node.name !== selector.name && selector.name !== '*') return false; // remove toLowerCase() in v2, when uppercase elements will be forbidden
if (node.name.toLowerCase() !== selector.name.toLowerCase() && selector.name !== '*') return false;
} }
else if (selector.type === 'RefSelector') { else if (selector.type === 'RefSelector') {

@ -0,0 +1,22 @@
export default {
cascade: false,
warnings: [{
message: 'P component is not defined',
loc: {
line: 2,
column: 1
},
end: {
line: 2,
column: 22
},
pos: 7,
frame: `
1: <div>
2: <P>this is styled</P>
^
3: </div>
4:`
}]
};

@ -0,0 +1 @@
<div><p class="svelte-xyz">this is styled</p></div>

@ -0,0 +1,9 @@
<div>
<P>this is styled</P>
</div>
<style>
p {
color: red;
}
</style>
Loading…
Cancel
Save