Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove ES2015 let from css block #351

Merged
merged 1 commit into from
Mar 7, 2017
Merged

Remove ES2015 let from css block #351

merged 1 commit into from
Mar 7, 2017

Conversation

timhall
Copy link
Contributor

@timhall timhall commented Mar 7, 2017

A let has snuck by the in the generated code for adding css:

Input:

<h1>Hello {{name}}!</h1>

<style>
  h1 {
    color: red;
  }
</style>

Output:

let addedCss = false;
function addCss () {
	var style = createElement( 'style' );
	style.textContent = "\n  h1[svelte-895830737], [svelte-895830737] h1 {\n    color: red;\n  }\n";
	appendNode( style, document.head );

	addedCss = true;
}

function renderMainFragment ( root, component ) {
// ...

It is sneaking by the ES5 syntax check in the tests (introduced in #82) because the css block is appended before the starting point of the check, renderMainFragment. I played with possible ways of updating the check, but I couldn't find a non-hacky approach since there are few types of blocks that may appear (at least applyComputations and addCss).

Thanks so much for your work on this framework, it's great!

@Rich-Harris Rich-Harris merged commit 93b0b0e into sveltejs:master Mar 7, 2017
@Rich-Harris
Copy link
Member

Ha, whoops! Thank you for the fix. Will think about how we might change that test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants