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

Multiple CSS selectors separated by commas don't work #3960

Closed
notwaldorf opened this issue Sep 16, 2016 · 6 comments
Closed

Multiple CSS selectors separated by commas don't work #3960

notwaldorf opened this issue Sep 16, 2016 · 6 comments

Comments

@notwaldorf
Copy link
Contributor

If I have this in a <dom-module id="paper-material"><template><style> element:

.paper-material([elevation="1"]), .paper-material.elevation-1 {
  color: red;
}

Then this style doesn't apply on a div class="paper-material elevation-1. If I split the comma separated selector into 2 separate ones, then everything is fine.

@dgabrielli76
Copy link

You are right, I have the same problem with mixins. The style is apply only on the first mixin.

@notwaldorf
Copy link
Contributor Author

/cc @azakus

@notwaldorf
Copy link
Contributor Author

I think I was holding this selector wrong. TIL if any of the selectors are wrong in a comma separated list of selectors, everything is borked. Closing!

@dfreedm
Copy link
Member

dfreedm commented Sep 21, 2016

There are a few specific cases where Polymer makes this hard in the 1.x -> 2.x transition, which are issues #3924 and webcomponents/shadycss#10

@jfrazzano
Copy link

this worked for me when updating a few thousand gridboxes on three
different routed pages, and updating changes to indexed db, firebase, and
outside js prototyped datahandler, will send the related behavior next if
anyone is interested. Essentially, have a contextual mediator that injects
css into the cssText field, you parse out what you want gone add what you
want to add. Performance way better, the only consistent cross browser way
I could manage to impliment a context styles menu on a self resizing,
computation heavy grid.

Maybe not polymer spec... but the message since IO has been clear,
Polymer is here to help, the developers there are fighting hard for a more
dynamic work space for all of us, we have to help. If anyone wants anything
along this line,. its cool I will let you just pick and choose. Its about
8000 elements from over the last year.

We are going to straight vanilla. Polymer though, was-- at least for me--
my full education and implementation mentor, guide and sensai... You guys
moved the world forward, or at least the folks over here at Focused. Thank
you... Anything we can do to help, just insinuate...it will be clue enough

chunkMutationForMultiDimensionalArrays(array,property, fullvalue, this){
var keys=array[0][0].key.split("");
var cellClass="." + keys[0];
console.log(nodeList);
var nodeList=document.querrySelectorAll(cellClass);
var counter=nodeList.length;
var p=0;
for(p=0;p<counter; p++)
{
cell=nodeList[p];
if(cell.style.match(property))
{
var replacer= new
RegExp('(('+property+')+(\w
|\s_|:)+(\w|\s|-|#)+(;|(\w|\s|\b)+;|\b))+','g');
cell.style=cell.style.replace(replacer, "");
}
var cellStyle=cell.style+fullVal + " ";
cell.style =cellStyle;
var model=elem._templateInstance;
model.set("item.style",cellStyle);
this[mapName].set(newKey,[cell.value, cell]);
this.updateObjectStores(arrayName, 1, newKey, "style",
cellStyle);
}
},
console.log(nodeList);

        var  newArray=this[arrayName].map(function(value, index){
                if(index!=0){
                return value.map(function(cell, m, arr){
                    if(m!==0)
                    {
                        if(cell.style.match(property))
                        {
                          var replacer= new

RegExp('(('+property+')+(\w_|\s_|:)+(\w|\s|-|#)+(;|(\w|\s|\b)+;|\b))+','g');
cell.style=cell.style.replace(replacer, "");

                        }
                      var cellStyle=cell.style+fullVal  + " ";
                      cell.style =cellStyle;
                      var newKey= cell.id;
                      var theId="#"+newKey, elem=this.$$(theId);
                      var model=elem._templateInstance;
                      model.set("item.style",cellStyle);
                      this[mapName].set(newKey,[cell.value, cell]);
                      this.updateObjectStores(arrayName, 1, newKey,

"style", cellStyle);
}
return cell;
},this);
}
return value;},this);

On Wed, Sep 21, 2016 at 2:38 PM, Daniel Freedman notifications@github.com
wrote:

There are a few specific cases where Polymer makes this hard in the 1.x ->
2.x transition, which are issues #3924
#3924 and
webcomponents/shadycss#10
webcomponents/shadycss#10


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#3960 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AHxnviKYvGkbPaG1KrVz7uBgcLVwzItRks5qsXmsgaJpZM4J-qkH
.


Jason C. Frazzano Esq.
Founder and Master Coach, Focused Coaching
Stanford University, B.A. M.A., with honors and distinction
Columbia Law School, J.D., Stone Scholar
www.focusedcoaching.com
jason@focusedcoaching.com
jfrazzano@gmail.com
office: 732-671-1834

@jfrazzano
Copy link

Can I just send this way? It seems obnoxious... but the stuff works and is
adaptable and solves the problem in the standard that was, so my take is
anyone wants the work, take it... that's why we all are here.

Gimme advice on protocol... I only been coding a bit, and always felt
embarrassed to like push my stuff, but this problem I know we had.. there
are a lot of work arounds in like straight js, even old DOM standards stuff
if you'll regExp, // | $${item.superItem}, or just use a queryable dom
string (anchor tag on string proto is last sorta left from dom 1, and you
can more or less just affect the dom as much as you like... you can even
store your stringish elements in a map and just change them, since they are
objects not primitives, same pointer... change the map, change the dom...

here is the behavior

sorry if its annoying, will stop... I just spent months silent on similar
was dumb not to ask, you guys always help

<script> (function(){ "use strict"; })(); window.FCBehaviors = window.FCBehaviors || {}; FCBehaviors.FcGridStyleBehaviorImpl = { listeners: {"color-picker-selected":"getcolor"}, properties: { gridEvent:{ type: Object, value: function(){return {};}, observer: "observeGridEvent", notify: true }, btnText:{ type: String, value:function(){return "";}, notify: true }, defaultFormat:{ type:Object, value:function(){ return {"color": "#9", "background": "#fefefe", "header_backgroundColor":"aliceblue", "fontSize": "18px", "fontWeight": "600", "fontFamily": "merriweather", "lineHeight": "1.15", "border": "1px #afafaf solid", "styleText": "margin:0px; box-shadow: 1px 3px 4px 2px #fafafa; cursor: cell;font-size: 18px; font-weight: 600; color: #9; font-family: merriweather; text-align: center; white-space: wrap; max-height: 45px; min-height: 45px; border: 1px solid #afafaf; padding-top: 4px; font-family: merriweather; text-align: center; font-size: 18px; resize:none;"}; }, notify: true }, defaultHeader:{ type:Object, value:function(){ return {"max-height": "65px;","border": "solid 1px #9;", "min-height": "18px;", "margin": "0px;", "height":"23px!important;", "font-family":"merriweather;", "background": "aliceblue;", "color": " #9;", "text-align": "center;", "font-size": "18px;","font-weight":"700;", "resize":"none;", "styleText":"max-height: 65px; border: solid 1px #9; min-height: 18px; margin: 0px; height:23px!important; font-family:merriweather; background: aliceblue; color: #9; text-align: center; font-size: 18px; font-weight:700; resize:none;"}; }, notify: true, }, allSymbols:{ type:String, value:function(){return `➔ ❶ ✂ ✎ ✒ ✜ ❚ ❶ ➀ ➞ ☚ ☛ ☰ ☱ ☷ ☑ ☐ ☎ ☏ ► ▼ ▲ ◄ ⇒ Δ ▐ █ ▄ ▀`;}, notify: true, }, color:{ type: String, value:function(){return "#9";}, notify: true }, background:{ type: String, value:function(){return "#F0F8FF";}, notify: true }, columnArchive:{ type: Array, value: function(){return [];}, notify: true }, gridEventArchive:{ type:Array, value:function(){return [];}, notify: true }, returnDataObject:{ type: Object, notify: true, value:function(){return {};}, }, archivist:{ type:Object, value:function(){return [];}, notify: true }, }, ready(){ //console.log(this.mapsArray); }, detached(){}, setDataArgs(menuArray){ var newMenuArray=menuArray.map(function(val, index, array){ var newButtons=val.buttons.map(function(button,i, ar){ button.dataArgs={"setValue": button.dataSetValue, "property": button.dataProperty, "propertyAndValue": button.dataProperty+" " +button.dataSetValue}; return button;}); //console.log(val.buttons); val.buttons=newButtons; ////console.log(newButtons,val.buttons); return val; }); return newMenuArray; }, get columnMenu(){ var menuArray= [ { "title": "Adding & Deleting Columns", "buttons":[ {"text": ["+1 Column Right: ","", " ✜ ▐ ☛"],"myFunction": this.addColumn.bind(this)}, {"text":["+1 Column Left: ",""," ✜ ▐ ☚"], "myFunction": this.addColumn.bind(this)}, {"text":["Delete Column: ","", " ✂ ▐"], "myFunction": this.deleteThisColumn.bind(this)}, {"text": ["Restore Column: ", , "☤ ▐ ☤"], "myFunction":this.restoreThisColumn.bind(this)} ] }, { "title":"Column Highlighting Patterns", "boundFunctionString":this.alternatingHighlighter.toString(), "function":this.alternatingHighlighter.bind(this), "buttons": [ {"text":["Add Odd Numbered Column Highlighter", "",""], "dataProperty": "background:", "dataSetValue":this.background, "myFunction":this.alternatingHighlighter.bind(this), }, { "text":["Remove Odd Numbered Columns' Highlight", "",""], "dataProperty":"background:", "dataSetValue":`${this.defaultFormat.background};`, "myFunction": this.alternatingHighlighter.bind(this) }, { "text":["Add Even Numbered Column Highlighting", "",""], "dataProperty": "background:", "dataSetValue ": this.background+"; ", "myFunction":this.alternatingHighlighter.bind(this) }, { "text":["Remove Even Numbered Columns' Highlight", "",""], "dataProperty":"background:", "dataSetValue":`${this.defaultFormat.background};`, "myFunction": this.alternatingHighlighter.bind(this) }, { "text":["Shift Column Highlight Left One Column", "",""], "dataProperty": "background:", "dataSetValue ": this.background+"; ", "myFunction":this.alternatingHighlighter.bind(this) }, { "text":["Shift Column Highlight Right One Column", "",""], "dataProperty": "background:", "dataSetValue ": this.background +";", "myFunction":this.alternatingHighlighter.bind(this) }, { "text":["Begin and End Column Highlight On Tap", "",""], "dataProperty":"background:", "dataSetValue ": this.background + ";", "myFunction":this.alternatingHighlighter.bind(this), // "additionalRequirements": get dragWrapperSelectionHandler(), }, ] }, ]; var returnArray=this.setDataArgs(menuArray); return returnArray; }, get rowMenu(){var menuArray= [ { "title": "Inserting & Excising Rows", "buttons": [ {"text": ["+1 Row Above:", ," ☰ ▲ "] ,"myFunction": this.insertRow.bind(this)}, {"text":["+1 Row Below:", ," ☰ ▼ "], "myFunction": this.insertRow.bind(this)}, {"text": ["Delete Row: "," ", " ✂ ☰"],"myFunction": this.deleteRow.bind(this)}, {"text":["Restore Row: ","☤", " ☤ ☰ ☤ "], "myFunction": this.restoreRow.bind(this)} ] }, { "title":"Row Highlighting Patterns", "buttons": [ { "text": ["Add Odd Numbered Row Highlighting", " ", " "], "dataProperty":"background:", "dataSetValue":this.background, "myFunction":this.alternatingHighlighter.bind(this), "dataArgs":[] }, { "text": ["Add Even Numbered Row Highlighting", " ", " "], "dataProperty":"background:", "dataSetValue":this.background, "myFunction":this.alternatingHighlighter.bind(this), "dataArgs":[] }, { "text":["Remove Odd Numbered Row Highlighting"], "dataProperty":"background:", "dataSetValue": this.defaultFormat.background, "dataFunction": "alternatingHighlighter", "myFunction":this.alternatingHighlighter.bind(this), "dataArgs":[ ] }, { "text":["Remove Even Numbered Row Highlighting"], "dataProperty":"background:", "dataSetValue": this.defaultFormat.background, "dataFunction": "alternatingHighlighter", "myFunction":this.alternatingHighlighter.bind(this), "dataArgs":[ ] }, {"text":["Begin and End Row Highlight On Tap", "",""],"myFunction":this.alternatingHighlighter.bind(this)}, ], //End Six Button Page }]; var returnArray=this.setDataArgs(menuArray); return returnArray; }, get basemenu(){ var menuArray =[ {"title":"Highlight Color", "buttons":[ {"text":["Highlight Selection: ",""," ✒ ❚ "],"myFunction":this.stylePropertySelection.bind(this),"dataProperty": "background: ", "dataSetValue ": this.background}, {"text":["Remove Highlighting: ", ," ✂ ✒"], "myFunction":this.stylePropertySelection.bind(this), "dataProperty": "background: ", "dataSetValue ": `${this.defaultFormat.background};`}] }, { "title": "Text Color", "buttons": [ {"text":["Apply This Text Color:"," ✎" , "▀"], "myFunction":this.stylePropertySelection.bind(this), "dataProperty":"color:", "dataSetValue": this.color, }, {"text":["Apply Base Text Color:"," ✎ " , "▀"], "myFunction":this.stylePropertySelection.bind(this), "dataProperty": "color: ", "dataSetValue": this.defaultFormat.color} ] }, { "title": "Text Weight", "buttons": [ {"text":["Thin Text Weight:", ,"𝒯𝒽𝒾𝓃"],"myFunction":this.stylePropertySelection.bind(this),"dataProperty": "font-weight:","dataSetValue": " 300;"}, {"text":["Medium Text Weight:", ,"Medium"],"myFunction":this.stylePropertySelection.bind(this), "dataProperty": "font-weight:","dataSetValue": " 600;"}, {"text":["Strong Text Weight", "STRONG"], "myFunction":this.stylePropertySelection.bind(this), "dataProperty": "font-weight:", "dataSetValue": " 900;" } ] }, { "title": "Font Family", "buttons": [ {"text": ["Roboto Font Family", ," ROBOTO"],"myFunction":this.stylePropertySelection.bind(this), "dataProperty": "font-family:", "dataSetValue": "roboto;"}, {"text":["Merriweather Font Family", ," Merriweather"], "myFunction":this.stylePropertySelection.bind(this), "dataProperty": "font-family:", "dataSetValue": "merriweather;"}, {"text":["Courier Font Family: ", ," Courier"], "myFunction":this.stylePropertySelection.bind(this), "dataProperty": "font-family:", "dataSetValue": "courier;" } ], }, { "title":"Font Styles", "buttons": [ {"text": [`Italics: Italics`],"myFunction":this.stylePropertySelection.bind(this),"dataProperty":"font-style:", "dataSetValue": " italic;"}, {"text":["Underline:", ,"Underline"],"myFunction":this.stylePropertySelection.bind(this),"dataProperty":"text-decoration:", "dataSetValue":" underline;"}, {"text": ["Strike-Through:", ,"Strike-Through"], "myFunction":this.stylePropertySelection.bind(this),"dataProperty":"text-decoration:", "dataSetValue":" line-through;"}, {"text": ["Normal: ", , " Normal"], "myFunction":this.stylePropertySelection.bind(this),"dataProperty":"text-decoration:", "dataSetValue": " none;"}, {"text": ["Clear Italics:", , "Normal"], "myFunction":this.stylePropertySelection.bind(this),"dataProperty": "font-style:","dataSetValue": " normal;" } ], }, { "title":"Font Size", "buttons": [ {"text":[`10px Smallest Large Screen Font`],"myFunction":this.stylePropertySelection.bind(this),"dataProperty":"font-size:10px;"}, {"text":["12px", "","Smaller Than Shown"],"myFunction":this.stylePropertySelection.bind(this),"dataProperty":"font-size:", "dataSetValue": " 12px;"}, {"text": ["14px", "", "Slightly Smaller"], "myFunction":this.stylePropertySelection.bind(this),"dataProperty":"font-size:", "dataSetValue": " 14px;"}, {"text": ["16px", "", "Slightly Smaller"], "myFunction":this.stylePropertySelection.bind(this),"dataProperty":"font-size:", "dataSetValue": " 16px;"}, {"text": ["18px","", "Focused Standard"], "myFunction":this.stylePropertySelection.bind(this),"dataProperty":"font-size:", "dataSetValue": " 18px;"}, {"text": ["20px", "", "Slightly Smaller"], "myFunction":this.stylePropertySelection.bind(this),"dataProperty":"font-size:", "dataSetValue": " 20px;"}, {"text": ["22px","","Section Header Font"], "myFunction":this.stylePropertySelection.bind(this),"dataProperty":"font-size:", "dataSetValue": " 22px;"}, {"text": ["24px","","Section Header Font"], "myFunction":this.stylePropertySelection.bind(this),"dataProperty":"font-size:", "dataSetValue": " 24px;"}, {"text": ["26px","","Header Font"], "myFunction":this.stylePropertySelection.bind(this),"dataProperty":"font-size:", "dataSetValue": " 26px;"}, {"text": ["28px","","Header Font"], "myFunction":this.stylePropertySelection.bind(this),"dataProperty":"font-size:", "dataSetValue": " 28px;"}, {"text": ["30px","","Header Font"], "myFunction":this.stylePropertySelection.bind(this),"dataProperty":"font-size:", "dataSetValue": " 30px;"}, {"text": ["32px", "","Banner Font"],"myFunction":this.stylePropertySelection.bind(this), "dataProperty": "font-size:", "dataSetValue": " 32px;"}, {"text": ["34px", "","Banner Font"],"myFunction":this.stylePropertySelection.bind(this), "dataProperty": "font-size:", "dataSetValue": " 34px;"}, {"text": ["36px","", "Banner Font"],"myFunction":this.stylePropertySelection.bind(this), " dataProperty": "font-size:", "dataSetValue": " 36px;"} ], }, ]; var returnArray=this.setDataArgs(menuArray); return returnArray; }, observeGridEvent(newEvent, oldEvent){ if(newEvent&&newEvent!=oldEvent){ console.log(newEvent, oldEvent); } }, onGridEventChanged(){ }, getcolor(e){ this.set("color", e.detail.color); }, // chunked(arr, chunkSize) { // var groups = [], i; // for (i = 0; i < arr.length; i += chunkSize) { // groups.push(arr.slice(i, i + chunkSize)); // } // return groups; // }, chunkMutationForMultiDimensionalArrays(array,property, fullvalue, context,index, notify, unitArray){ var keys=array[0][0].id.split("_"); var cellClass="." + keys[0]; var mapName="m"+keys[0]; var arrayName=keys[0]; var p=0; if(!unitArray || (unitArray&&index==context.arrayIndex)){ var nodeList=Polymer.dom(this.root).querySelectorAll(cellClass); var counter=nodeList.length; } else{ var counter=unitArray.length; } for(p=0;p

On Tue, Sep 27, 2016 at 11:40 PM, Jason Frazzano jfrazzano@gmail.com
wrote:

this worked for me when updating a few thousand gridboxes on three
different routed pages, and updating changes to indexed db, firebase, and
outside js prototyped datahandler, will send the related behavior next if
anyone is interested. Essentially, have a contextual mediator that injects
css into the cssText field, you parse out what you want gone add what you
want to add. Performance way better, the only consistent cross browser way
I could manage to impliment a context styles menu on a self resizing,
computation heavy grid.

Maybe not polymer spec... but the message since IO has been clear,
Polymer is here to help, the developers there are fighting hard for a more
dynamic work space for all of us, we have to help. If anyone wants anything
along this line,. its cool I will let you just pick and choose. Its about
8000 elements from over the last year.

We are going to straight vanilla. Polymer though, was-- at least for me--
my full education and implementation mentor, guide and sensai... You guys
moved the world forward, or at least the folks over here at Focused. Thank
you... Anything we can do to help, just insinuate...it will be clue enough

chunkMutationForMultiDimensionalArrays(array,property, fullvalue, this){
var keys=array[0][0].key.split("");
var cellClass="." + keys[0];
console.log(nodeList);
var nodeList=document.querrySelectorAll(cellClass);
var counter=nodeList.length;
var p=0;
for(p=0;p<counter; p++)
{
cell=nodeList[p];
if(cell.style.match(property))
{
var replacer= new RegExp('(('+property+')+(\w
|
\s_|:)+(\w|\s|-|#)+(;|(\w|\s|\b)+;|\b))+','g');
cell.style=cell.style.replace(replacer, "");
}
var cellStyle=cell.style+fullVal + " ";
cell.style =cellStyle;
var model=elem._templateInstance;
model.set("item.style",cellStyle);
this[mapName].set(newKey,[cell.value, cell]);
this.updateObjectStores(arrayName, 1, newKey, "style",
cellStyle);
}
},
console.log(nodeList);

        var  newArray=this[arrayName].map(function(value, index){
                if(index!=0){
                return value.map(function(cell, m, arr){
                    if(m!==0)
                    {
                        if(cell.style.match(property))
                        {
                          var replacer= new

RegExp('(('+property+')+(\w_|\s_|:)+(\w|\s|-|#)+(;|(
\w|\s|\b)+;|\b))+','g');
cell.style=cell.style.replace(replacer, "");

                        }
                      var cellStyle=cell.style+fullVal  + " ";
                      cell.style =cellStyle;
                      var newKey= cell.id;
                      var theId="#"+newKey, elem=this.$$(theId);
                      var model=elem._templateInstance;
                      model.set("item.style",cellStyle);
                      this[mapName].set(newKey,[cell.value, cell]);
                      this.updateObjectStores(arrayName, 1, newKey,

"style", cellStyle);
}
return cell;
},this);
}
return value;},this);

On Wed, Sep 21, 2016 at 2:38 PM, Daniel Freedman <notifications@github.com

wrote:

There are a few specific cases where Polymer makes this hard in the 1.x
-> 2.x transition, which are issues #3924
#3924 and
webcomponents/shadycss#10
webcomponents/shadycss#10


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#3960 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AHxnviKYvGkbPaG1KrVz7uBgcLVwzItRks5qsXmsgaJpZM4J-qkH
.


Jason C. Frazzano Esq.
Founder and Master Coach, Focused Coaching
Stanford University, B.A. M.A., with honors and distinction
Columbia Law School, J.D., Stone Scholar
www.focusedcoaching.com
jason@focusedcoaching.com
jfrazzano@gmail.com
office: 732-671-1834


Jason C. Frazzano Esq.
Founder and Master Coach, Focused Coaching
Stanford University, B.A. M.A., with honors and distinction
Columbia Law School, J.D., Stone Scholar
www.focusedcoaching.com
jason@focusedcoaching.com
jfrazzano@gmail.com
office: 732-671-1834

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

4 participants