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

custom-style containing '/deep/' or '::shadow' produces an SyntaxError in Firefox #2263

Closed
urandom opened this issue Aug 13, 2015 · 4 comments
Assignees
Labels

Comments

@urandom
Copy link

urandom commented Aug 13, 2015

The problem occurs when the rule is passed to the Element.prototype.matches function.
Firefox throws the following:

SyntaxError: An invalid or illegal string was specified

The location of the error is in Polymer.StyleProperties.propertyDataFromStyles, when the matchesSelector is called on the rule. The rule with which I reproduce it is 'body /deep/ *', but any rule which contains /deep/ and ::shadow will trigger the error.

Before the custom-style element, the html contains both the script for webcomponents-lite.min.js, as well as the import for polymer.html.

@urandom
Copy link
Author

urandom commented Aug 14, 2015

Some additions:

  1. The rules must have custom properties, or the previous check (propertyInfo.properties) in the if will return false and the error won't be triggered
  2. The problem also occurs in polymer 1.1. In it, rule.transformedSelector is undefined

@sorvell sorvell self-assigned this Aug 15, 2015
@sorvell sorvell added the p1 label Aug 15, 2015
@sorvell
Copy link
Contributor

sorvell commented Aug 19, 2015

@sorvell
Copy link
Contributor

sorvell commented Aug 20, 2015

We're going to fix this to avoid the exception, however, using /deep/ to define custom properties is not something the custom property shim has good support for. Only elements in the document scope (not shady or shadow-roots) will get the custom properties.

This is due to how Polymer's custom property shim is designed to work and is not likely to change. Instead, a property value is intended to inherit down the dom tree.

@sorvell
Copy link
Contributor

sorvell commented Aug 20, 2015

A selector like body /deep/ * should just be replaced with :root. I will effectively do the same thing.

frankiefu added a commit that referenced this issue Aug 20, 2015
Fixes #2263: ensure custom-style can parse variable definitions in su…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants