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

CSS Parser does not support # character #530

Closed
caridy opened this issue Jul 23, 2018 · 0 comments
Closed

CSS Parser does not support # character #530

caridy opened this issue Jul 23, 2018 · 0 comments

Comments

@caridy
Copy link
Contributor

caridy commented Jul 23, 2018

Description

Steps to Reproduce

Found this one in the todo-mvc css when trying to move the css to the component.

.todo-list .li .toggle + label {
	/*
		Firefox requires the hash to be escaped - https://bugzilla.mozilla.org/show_bug.cgi?id=922433
		IE and Edge requires *everything* to be escaped to render, so we do that instead of just the hash - https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/7157459/
	*/
	background-image: url('data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2240%22%20height%3D%2240%22%20viewBox%3D%22-10%20-18%20100%20135%22%3E%3Ccircle%20cx%3D%2250%22%20cy%3D%2250%22%20r%3D%2250%22%20fill%3D%22none%22%20stroke%3D%22%23ededed%22%20stroke-width%3D%223%22/%3E%3C/svg%3E');
	background-repeat: no-repeat;
	background-position: center left;
}

Expected Results

It should compile.

Actual Results

[0] rollup v0.63.4
[0] bundles /Users/cpatino/repo/lwc-todomvc/src/main.js → public/js/main.js...
[0] [!] Error: Unexpected character '#'
[0] src/todo/item/item.css (157:20)
[0] 155:   /*
[0] 156:     Firefox requires `#` to be escaped - https://bugzilla.mozilla.org/show_bug.cgi?id=922433
[0] 157:     IE and Edge requires *everything* to be escaped to render, so we do that instead of just the `#` - https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/7157459/
[0]                            ^
[0] 158:   */
[0] 159:   background-image: url('data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2240%22%20height%3D%2240%22%20viewBox%3D%22-10%20-18%20100%20135%22%3E%3Ccircle%20cx%3D%2250%22%20cy%3D%2250%22%20r%3D%2250%22%20fill%3D%22none%22%20stroke%3D%22%23ededed%22%20stroke-width%3D%223%22/%3E%3C/svg%3E');
[0]
[0] 1
error Command failed with exit code 1.
diervo pushed a commit that referenced this issue Jul 26, 2018
## Details

Escape backtick and backslash in CSS source. In any CSS file, today usage of:
* backtick makes the compiler produce an invalid javascript
* backslash escape the next character

Fix #530 

## Does this PR introduce a breaking change?

* [ ] Yes
* [X] No
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

No branches or pull requests

2 participants