mirror of https://github.com/sveltejs/svelte
Merge pull request #1190 from sveltejs/gh-1118
Use classes for style encapsulation, rather than attributespull/1220/head
commit
46c9ad4221
@ -1,8 +1,8 @@
|
|||||||
// https://github.com/darkskyapp/string-hash/blob/master/index.js
|
// https://github.com/darkskyapp/string-hash/blob/master/index.js
|
||||||
export default function hash(str: string): number {
|
export default function hash(str: string): string {
|
||||||
let hash = 5381;
|
let hash = 5381;
|
||||||
let i = str.length;
|
let i = str.length;
|
||||||
|
|
||||||
while (i--) hash = ((hash << 5) - hash) ^ str.charCodeAt(i);
|
while (i--) hash = ((hash << 5) - hash) ^ str.charCodeAt(i);
|
||||||
return hash >>> 0;
|
return (hash >>> 0).toString(36);
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
[foo][svelte-xyz]{color:red}[baz][svelte-xyz]{color:blue}
|
[foo].svelte-xyz{color:red}[baz].svelte-xyz{color:blue}
|
@ -1 +1 @@
|
|||||||
[foo=bar][svelte-xyz]{color:red}
|
[foo=bar].svelte-xyz{color:red}
|
@ -1 +1 @@
|
|||||||
div[svelte-xyz],[svelte-xyz] div{color:red}
|
div.svelte-xyz,.svelte-xyz div{color:red}
|
@ -1 +1 @@
|
|||||||
.foo[svelte-xyz]{}
|
.foo.svelte-xyz{}
|
@ -1 +1 @@
|
|||||||
@keyframes why{0%{color:red}100%{color:blue}}.animated[svelte-xyz]{animation:why 2s}.also-animated[svelte-xyz]{animation:not-defined-here 2s}
|
@keyframes why{0%{color:red}100%{color:blue}}.animated.svelte-xyz{animation:why 2s}.also-animated.svelte-xyz{animation:not-defined-here 2s}
|
@ -1 +1 @@
|
|||||||
@keyframes svelte-xyz-why{from{color:red}to{color:blue}}.animated[svelte-xyz]{animation:svelte-xyz-why 2s}
|
@keyframes svelte-xyz-why{from{color:red}to{color:blue}}.animated.svelte-xyz{animation:svelte-xyz-why 2s}
|
@ -1 +1 @@
|
|||||||
@keyframes svelte-xyz-why{0%{color:red}100%{color:blue}}.animated[svelte-xyz]{animation:svelte-xyz-why 2s}.also-animated[svelte-xyz]{animation:not-defined-here 2s}
|
@keyframes svelte-xyz-why{0%{color:red}100%{color:blue}}.animated.svelte-xyz{animation:svelte-xyz-why 2s}.also-animated.svelte-xyz{animation:not-defined-here 2s}
|
@ -1 +1 @@
|
|||||||
span[svelte-xyz]::after{content:'i am a pseudo-element'}span[svelte-xyz]:first-child{color:red}span[svelte-xyz]:last-child::after{color:blue}
|
span.svelte-xyz::after{content:'i am a pseudo-element'}span.svelte-xyz:first-child{color:red}span.svelte-xyz:last-child::after{color:blue}
|
@ -1 +1 @@
|
|||||||
[svelte-xyz]{color:red}
|
.svelte-xyz{color:red}
|
@ -1 +1 @@
|
|||||||
<div svelte-xyz=""></div>
|
<div class="svelte-xyz"></div>
|
@ -1 +1 @@
|
|||||||
div[svelte-xyz]{color:red}div.foo[svelte-xyz]{color:blue}.foo[svelte-xyz]{font-weight:bold}
|
div.svelte-xyz{color:red}div.foo.svelte-xyz{color:blue}.foo.svelte-xyz{font-weight:bold}
|
@ -1 +1 @@
|
|||||||
.test[svelte-xyz]>div[svelte-xyz]{color:#0af}
|
.test.svelte-xyz>div.svelte-xyz{color:#0af}
|
@ -1 +1 @@
|
|||||||
<div svelte-xyz="" class="test"><div svelte-xyz="">Testing...</div></div>
|
<div class="test svelte-xyz"><div class="svelte-xyz">Testing...</div></div>
|
@ -1 +1 @@
|
|||||||
div[svelte-xyz],[svelte-xyz] div{--test:10}
|
div.svelte-xyz,.svelte-xyz div{--test:10}
|
@ -1 +1 @@
|
|||||||
p[svelte-xyz] span[svelte-xyz]{color:red}
|
p.svelte-xyz span.svelte-xyz{color:red}
|
@ -1 +1 @@
|
|||||||
<div><p svelte-xyz=''><span svelte-xyz=''>styled</span></p></div>
|
<div><p class="svelte-xyz"><span class="svelte-xyz">styled</span></p></div>
|
@ -1 +1 @@
|
|||||||
@keyframes svelte-xyz-why{0%{color:red}100%{color:blue}}[svelte-xyz].animated,[svelte-xyz] .animated{animation:svelte-xyz-why 2s}
|
@keyframes svelte-xyz-why{0%{color:red}100%{color:blue}}.svelte-xyz.animated,.svelte-xyz .animated{animation:svelte-xyz-why 2s}
|
@ -1 +1 @@
|
|||||||
@media only screen and (min-width: 400px){div[svelte-xyz],[svelte-xyz] div{color:red}}
|
@media only screen and (min-width: 400px){div.svelte-xyz,.svelte-xyz div{color:red}}
|
@ -1 +1 @@
|
|||||||
@media(min-width: 400px){[svelte-xyz].large-screen,[svelte-xyz] .large-screen{display:block}}
|
@media(min-width: 400px){.svelte-xyz.large-screen,.svelte-xyz .large-screen{display:block}}
|
@ -1 +1 @@
|
|||||||
[data-foo*='bar'][svelte-xyz]{color:red}
|
[data-foo*='bar'].svelte-xyz{color:red}
|
@ -1,2 +1,2 @@
|
|||||||
<div><p svelte-xyz="" data-foo="foobarbaz">this is styled</p>
|
<div><p class="svelte-xyz" data-foo="foobarbaz">this is styled</p>
|
||||||
<p data-foo="fooBARbaz">this is unstyled</p></div>
|
<p data-foo="fooBARbaz">this is unstyled</p></div>
|
@ -1 +1 @@
|
|||||||
[data-foo='bar' i][svelte-xyz]{color:red}
|
[data-foo='bar' i].svelte-xyz{color:red}
|
@ -1,2 +1,2 @@
|
|||||||
<div><p svelte-xyz="" data-foo="BAR">this is styled</p>
|
<div><p class="svelte-xyz" data-foo="BAR">this is styled</p>
|
||||||
<p data-foo="BAZ">this is unstyled</p></div>
|
<p data-foo="BAZ">this is unstyled</p></div>
|
@ -1 +1 @@
|
|||||||
[data-foo='bar'][svelte-xyz]{color:red}
|
[data-foo='bar'].svelte-xyz{color:red}
|
@ -1,2 +1,2 @@
|
|||||||
<div><p svelte-xyz="" data-foo="whatever">this is styled</p>
|
<div><p class="svelte-xyz" data-foo="whatever">this is styled</p>
|
||||||
<p data-foo="baz">this is unstyled</p></div>
|
<p data-foo="baz">this is unstyled</p></div>
|
@ -1 +1 @@
|
|||||||
[data-foo='bar'][svelte-xyz]{color:red}
|
[data-foo='bar'].svelte-xyz{color:red}
|
@ -1,2 +1,2 @@
|
|||||||
<div><p svelte-xyz="" data-foo="bar">this is styled</p>
|
<div><p class="svelte-xyz" data-foo="bar">this is styled</p>
|
||||||
<p data-foo="baz">this is unstyled</p></div>
|
<p data-foo="baz">this is unstyled</p></div>
|
@ -1 +1 @@
|
|||||||
[data-foo|='bar'][svelte-xyz]{color:red}
|
[data-foo|='bar'].svelte-xyz{color:red}
|
@ -1,3 +1,3 @@
|
|||||||
<div><p svelte-xyz="" data-foo="bar">this is styled</p>
|
<div><p class="svelte-xyz" data-foo="bar">this is styled</p>
|
||||||
<p svelte-xyz="" data-foo="bar-baz">this is styled</p>
|
<p class="svelte-xyz" data-foo="bar-baz">this is styled</p>
|
||||||
<p data-foo="baz-bar">this is unstyled</p></div>
|
<p data-foo="baz-bar">this is unstyled</p></div>
|
@ -1 +1 @@
|
|||||||
[data-foo^='bar'][svelte-xyz]{color:red}
|
[data-foo^='bar'].svelte-xyz{color:red}
|
@ -1,2 +1,2 @@
|
|||||||
<div><p svelte-xyz="" data-foo="barbaz">this is styled</p>
|
<div><p class="svelte-xyz" data-foo="barbaz">this is styled</p>
|
||||||
<p data-foo="bazbar">this is unstyled</p></div>
|
<p data-foo="bazbar">this is unstyled</p></div>
|
@ -1 +1 @@
|
|||||||
[data-foo$='bar'][svelte-xyz]{color:red}
|
[data-foo$='bar'].svelte-xyz{color:red}
|
@ -1,2 +1,2 @@
|
|||||||
<div><p data-foo="barbaz">this is unstyled</p>
|
<div><p data-foo="barbaz">this is unstyled</p>
|
||||||
<p svelte-xyz="" data-foo="bazbar">this is styled</p></div>
|
<p class="svelte-xyz" data-foo="bazbar">this is styled</p></div>
|
@ -1 +1 @@
|
|||||||
[data-foo~='bar'][svelte-xyz]{color:red}
|
[data-foo~='bar'].svelte-xyz{color:red}
|
@ -1,2 +1,2 @@
|
|||||||
<div><p svelte-xyz="" data-foo="qux bar">this is styled</p>
|
<div><p class="svelte-xyz" data-foo="qux bar">this is styled</p>
|
||||||
<p data-foo="qux baz">this is unstyled</p></div>
|
<p data-foo="qux baz">this is unstyled</p></div>
|
@ -1 +1 @@
|
|||||||
[autoplay][svelte-xyz]{color:red}
|
[autoplay].svelte-xyz{color:red}
|
@ -1,2 +1,2 @@
|
|||||||
<div><video svelte-xyz autoplay></video>
|
<div><video class="svelte-xyz" autoplay></video>
|
||||||
<video></video></div>
|
<video></video></div>
|
@ -1 +1 @@
|
|||||||
.foo[svelte-xyz]{color:red}
|
.foo.svelte-xyz{color:red}
|
@ -1,2 +1,2 @@
|
|||||||
<p svelte-xyz="" class="whatever">this is styled</p>
|
<p class="whatever svelte-xyz">this is styled</p>
|
||||||
<p class="bar">this is unstyled</p>
|
<p class="bar">this is unstyled</p>
|
@ -1 +1 @@
|
|||||||
.foo[svelte-xyz]{color:red}
|
.foo.svelte-xyz{color:red}
|
@ -1,2 +1,2 @@
|
|||||||
<p svelte-xyz="" class="foo">this is styled</p>
|
<p class="foo svelte-xyz">this is styled</p>
|
||||||
<p class="bar">this is unstyled</p>
|
<p class="bar">this is unstyled</p>
|
@ -1 +1 @@
|
|||||||
.foo[svelte-xyz] .bar{color:red}
|
.foo.svelte-xyz .bar{color:red}
|
@ -1 +1 @@
|
|||||||
<div svelte-xyz="" class="foo"></div>
|
<div class="foo svelte-xyz"></div>
|
@ -1 +1 @@
|
|||||||
div[svelte-xyz]>p>em{color:red}
|
div.svelte-xyz>p>em{color:red}
|
@ -1 +1 @@
|
|||||||
<div svelte-xyz=""></div>
|
<div class="svelte-xyz"></div>
|
@ -1 +1 @@
|
|||||||
div[svelte-xyz]>p{color:red}
|
div.svelte-xyz>p{color:red}
|
@ -1 +1 @@
|
|||||||
<div svelte-xyz=""></div>
|
<div class="svelte-xyz"></div>
|
@ -1 +1 @@
|
|||||||
div>section>p[svelte-xyz]{color:red}
|
div>section>p.svelte-xyz{color:red}
|
@ -1 +1 @@
|
|||||||
<p svelte-xyz="">this may or may not be styled</p>
|
<p class="svelte-xyz">this may or may not be styled</p>
|
@ -1 +1 @@
|
|||||||
div>p[svelte-xyz]{color:red}
|
div>p.svelte-xyz{color:red}
|
@ -1 +1 @@
|
|||||||
<p svelte-xyz="">this may or may not be styled</p>
|
<p class="svelte-xyz">this may or may not be styled</p>
|
@ -1 +1 @@
|
|||||||
#foo[svelte-xyz]{color:red}
|
#foo.svelte-xyz{color:red}
|
@ -1,2 +1,2 @@
|
|||||||
<div svelte-xyz="" id="foo"></div>
|
<div class="svelte-xyz" id="foo"></div>
|
||||||
<div id="bar"></div>
|
<div id="bar"></div>
|
@ -1 +1 @@
|
|||||||
div[svelte-xyz] section p[svelte-xyz]{color:red}
|
div.svelte-xyz section p.svelte-xyz{color:red}
|
@ -1 +1 @@
|
|||||||
<div svelte-xyz=""><section><p svelte-xyz="">this is styled</p></section></div>
|
<div class="svelte-xyz"><section><p class="svelte-xyz">this is styled</p></section></div>
|
@ -1 +1 @@
|
|||||||
div[svelte-xyz] p[svelte-xyz]{color:red}
|
div.svelte-xyz p.svelte-xyz{color:red}
|
@ -1 +1 @@
|
|||||||
<div svelte-xyz=""><section><p svelte-xyz="">this is styled</p></section></div>
|
<div class="svelte-xyz"><section><p class="svelte-xyz">this is styled</p></section></div>
|
@ -1 +1 @@
|
|||||||
p[svelte-xyz]{color:red}
|
p.svelte-xyz{color:red}
|
@ -1 +1 @@
|
|||||||
<div><p svelte-xyz="">this is styled</p></div>
|
<div><p class="svelte-xyz">this is styled</p></div>
|
@ -1 +1 @@
|
|||||||
[svelte-ref-button].active[svelte-xyz]{color:red}
|
[svelte-ref-button].active.svelte-xyz{color:red}
|
@ -1 +1 @@
|
|||||||
<button class="active" svelte-ref-button="" svelte-xyz="">deactivate</button>
|
<button svelte-ref-button="" class="active svelte-xyz">deactivate</button>
|
@ -1 +1 @@
|
|||||||
[svelte-ref-a][svelte-xyz]{color:red}[svelte-ref-b][svelte-xyz]{color:green}
|
[svelte-ref-a].svelte-xyz{color:red}[svelte-ref-b].svelte-xyz{color:green}
|
@ -1,3 +1,3 @@
|
|||||||
<div svelte-xyz='' svelte-ref-a=''></div>
|
<div class="svelte-xyz" svelte-ref-a=''></div>
|
||||||
<div svelte-xyz='' svelte-ref-b=''></div>
|
<div class="svelte-xyz" svelte-ref-b=''></div>
|
||||||
<div></div>
|
<div></div>
|
@ -1 +1 @@
|
|||||||
@supports (display: grid){.maybe-grid[svelte-xyz]{display:grid}}
|
@supports (display: grid){.maybe-grid.svelte-xyz{display:grid}}
|
@ -1 +1 @@
|
|||||||
[svelte-xyz],[svelte-xyz] *{color:red}
|
.svelte-xyz,.svelte-xyz *{color:red}
|
@ -1 +1 @@
|
|||||||
div[svelte-xyz],[svelte-xyz] div{@apply --funky-div;}
|
div.svelte-xyz,.svelte-xyz div{@apply --funky-div;}
|
@ -1 +1 @@
|
|||||||
.bar[svelte-xyz]{color:red}
|
.bar.svelte-xyz{color:red}
|
@ -1 +1 @@
|
|||||||
<div svelte-xyz="" class="bar"></div>
|
<div class="bar svelte-xyz"></div>
|
@ -1 +1 @@
|
|||||||
.active[svelte-xyz]{color:red}.inactive[svelte-xyz]{color:blue}
|
.active.svelte-xyz{color:red}.inactive.svelte-xyz{color:blue}
|
@ -1 +1 @@
|
|||||||
<div svelte-xyz="" class="active"></div>
|
<div class="active svelte-xyz"></div>
|
@ -1 +1 @@
|
|||||||
.foo[svelte-xyz]{color:red}
|
.foo.svelte-xyz{color:red}
|
@ -1 +1 @@
|
|||||||
<div svelte-xyz="" class="foo"></div>
|
<div class="foo svelte-xyz"></div>
|
@ -1,2 +1,2 @@
|
|||||||
div[svelte-724714405],[svelte-724714405] div{color:red}
|
div.svelte-bzh57p,.svelte-bzh57p div{color:red}
|
||||||
div[svelte-300476157],[svelte-300476157] div{color:green}
|
div.svelte-4yw8vx,.svelte-4yw8vx div{color:green}
|
@ -1,8 +1,8 @@
|
|||||||
<div svelte-724714405>red</div>
|
<div class="svelte-bzh57p">red</div>
|
||||||
<div svelte-300476157>green: foo</div>
|
<div class="svelte-4yw8vx">green: foo</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div svelte-300476157>green: bar</div>
|
<div class="svelte-4yw8vx">green: bar</div>
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
div[svelte-724714405],[svelte-724714405] div{color:red}
|
div.svelte-bzh57p,.svelte-bzh57p div{color:red}
|
||||||
div[svelte-300476157],[svelte-300476157] div{color:green}
|
div.svelte-4yw8vx,.svelte-4yw8vx div{color:green}
|
@ -1,8 +1,8 @@
|
|||||||
<div svelte-724714405>red</div>
|
<div class="svelte-bzh57p">red</div>
|
||||||
<div svelte-300476157>green: foo</div>
|
<div class="svelte-4yw8vx">green: foo</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div svelte-300476157>green: bar</div>
|
<div class="svelte-4yw8vx">green: bar</div>
|
||||||
|
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
div[svelte-724714405],[svelte-724714405] div{color:red}
|
div.svelte-bzh57p,.svelte-bzh57p div{color:red}
|
@ -1 +1 @@
|
|||||||
<div svelte-724714405>red</div>
|
<div class="svelte-bzh57p">red</div>
|
@ -1 +1 @@
|
|||||||
div[svelte-724714405],[svelte-724714405] div{color:red}
|
div.svelte-bzh57p,.svelte-bzh57p div{color:red}
|
@ -1 +1 @@
|
|||||||
<div svelte-724714405>red</div>
|
<div class="svelte-bzh57p">red</div>
|
@ -1,2 +1,2 @@
|
|||||||
.foo[svelte-1719932608]{color:red}
|
.foo.svelte-sg04hs{color:red}
|
||||||
/*# sourceMappingURL=output.css.map */
|
/*# sourceMappingURL=output.css.map */
|
@ -1,2 +1,2 @@
|
|||||||
[svelte-1719932608].foo,[svelte-1719932608] .foo{color:red}
|
.svelte-sg04hs.foo,.svelte-sg04hs .foo{color:red}
|
||||||
/*# sourceMappingURL=output.css.map */
|
/*# sourceMappingURL=output.css.map */
|
Loading…
Reference in new issue