Transformation of simple selectors works incorrectly when the selector contains a rule for an iconset within a namespace.
From @jordanyaker on August 10, 2016 15:13
I ran in to this problem when attempting to style an icon within a specific iconset.
When prepping the styles for an element (i.e., _prepShimStyles), the selector transformations invoked by Polymer (i.e., _transformRule -> _transformComplexSelector -> _transformCompoundSelector -> _transformSimpleSelector) cause any selectors with an iconset name specified as an attribute (i.e., iron-icon[icon="communication:email"]) to be improperly modified to contain the scope (i.e., iron-icon[icon="communication.my-element:email"]).
During my investigation in to this issue, I found it to be rooted in the fact that the _transformSimpleSelector function is assuming that the first instance of : within a selector string is a pseudo-prefix. The split code within this function (i.e., selector.split(PSEUDO_PREFIX)) needs to be modified to correct this behavior.
Steps to Reproduce
Example:
- Create a new element (e.g.,
my-element) containing an<iron-icon icon="communication:email"></iron-icon>. - Add a CSS rule to the element in order to set the color of the element (e.g.,
iron-icon[icon="communication:email"] { color: #1f6f9a; }). - Create a demo page to display the element.
- View the demo page.
Expected Results
Icon should be displayed using a blue color.
Actual Results
Icon is displayed with whatever the default color is for icons.
Browsers Affected
- [x] Chrome
- [x] Firefox
- [x] Edge
- [x] Safari 9
- [x] Safari 8
- [x] IE 11
Versions
- Polymer: 1.4.0 & 1.6.1 confirmed
- webcomponents: 0.7.20 & 0.7.22 confirmed
Copied from original issue: Polymer/polymer#3852
Confirmed this is still an issue: http://jsbin.com/holiyeceda/edit?html,output Moving over to the correct repository.