Merge pull request #725 from sveltejs/gh-722

unescape `#` character
pull/727/head
Rich Harris 8 years ago committed by GitHub
commit f550035d93

@ -269,8 +269,9 @@ export default function dom(
let result = builder let result = builder
.toString() .toString()
.replace(/(\\\\)?@(\w*)/g, (match: string, escaped: string, name: string) => { .replace(/(\\\\)?([@#])(\w*)/g, (match: string, escaped: string, sigil: string, name: string) => {
if (escaped) return match.slice(2); if (escaped) return match.slice(2);
if (sigil !== '@') return match;
if (name in shared) { if (name in shared) {
if (options.dev && `${name}Dev` in shared) name = `${name}Dev`; if (options.dev && `${name}Dev` in shared) name = `${name}Dev`;

@ -2,6 +2,6 @@
<style> <style>
p { p {
color: red; color: #f00;
} }
</style> </style>

@ -3,6 +3,6 @@ export default {
const [ control, test ] = target.querySelectorAll( 'p' ); const [ control, test ] = target.querySelectorAll( 'p' );
assert.equal( window.getComputedStyle( control ).color, '' ); assert.equal( window.getComputedStyle( control ).color, '' );
assert.equal( window.getComputedStyle( test ).color, 'red' ); assert.equal( window.getComputedStyle( test ).color, 'rgb(255, 0, 0)' );
} }
}; };

Loading…
Cancel
Save