Skip to content

Commit

Permalink
Merge pull request #725 from sveltejs/gh-722
Browse files Browse the repository at this point in the history
unescape `#` character
  • Loading branch information
Rich-Harris authored Jul 28, 2017
2 parents e2980a8 + b701bf2 commit f550035
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/generators/dom/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,9 @@ export default function dom(

let result = builder
.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 (sigil !== '@') return match;

if (name in shared) {
if (options.dev && `${name}Dev` in shared) name = `${name}Dev`;
Expand Down
2 changes: 1 addition & 1 deletion test/runtime/samples/css/Widget.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

<style>
p {
color: red;
color: #f00;
}
</style>
2 changes: 1 addition & 1 deletion test/runtime/samples/css/_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ export default {
const [ control, test ] = target.querySelectorAll( 'p' );

assert.equal( window.getComputedStyle( control ).color, '' );
assert.equal( window.getComputedStyle( test ).color, 'red' );
assert.equal( window.getComputedStyle( test ).color, 'rgb(255, 0, 0)' );
}
};

0 comments on commit f550035

Please sign in to comment.