core-style
See the component page for more information.
Manage styling inside other elements and can be used to make themes.
Home Page: https://www.polymer-project.org/0.5/docs/elements/core-style.html
See the component page for more information.
The core-style demo currently looks different in IE11 compared to Chrome/Firefox. The numbers in the cards have different colors assigned in IE11. Shouldn't the result be equal in all supported browsers?
Having a detailed research I ended up here:
Polymer/polymer#1052 (comment)
I am understanding it right: Core-style
simply shares bits of CSS across elements?
If this is so I can use something like SASS or LESS, right? And simply share a partial or variables across my elements styling?
May be I can ask the question in this way: is core-style
intended for the developers that want or are forced to use vanilla CSS for styling?
I cant think of a scenario where a preprocessor like SASS would't fit a use-case that core-style
does.
Simpler core-style
view-source:https://www.polymer-project.org/components/core-style/demo.html
view-source:https://www.polymer-project.org/components/core-style/my-theme.html
view-source:https://www.polymer-project.org/components/core-style/elements.html
Would be less confusing if elements.html used inline <style>
tags and my-theme.html <core-style>
Using multiple core-styles with the same id can't be good considering vulcanizing etc.
2x <core-style id="my-toolbar">
2x <core-style id="my-panel">
The idea is to allow local customization of the variables in producers.
An example use case would be:
Since there are already customization vars in the producer, I'd prefer not to write a ton of CSS all over again, but to reuse the existing producer with new, local, variables.
Sample API:
<!-- global params -->
<script>
CoreStyle.g.myColor = red;
</script>
<!-- parameterized producer -->
<core-style id="myProducer">
selector {
color: {{g.myColor}}; /* default to CoreStyle.params.myColor */
}
</core-style>
<!-- refined producer -->
<core-style refines="myProducer" select=".css-selector">
g.myColor = red; // local parameter just for this instance
</core-style>
The select=".css-selector"
could be used to target a subset of elements that have a paired consumer, so it can be applied selectively.
If the select
attribute would be missing the refinement would apply globally.
Hi there.
I read the core-style
docs and saw the following sentence:
It kind of looked like that the period shouldn't be there and that this sentence really wants to say: "Using core-style
in HTML Imports is currently not supported.".
Since I think that using core-style
inside HTML Imports is the actual win, I wanted to open an issue and ask what the status of this thing is.
But when we look at the source file where the actual documentation is written, we see this: https://github.com/Polymer/core-style/blob/master/core-style.html#L20-L22
So it seems that core-component-page
breaks that paragraph (and using core-style
in HTML Imports is supported). I haven't looked at the exact issue yet, but I have a feeling that it has something to do with the @import
in the sentence.
The core-style consumers are added in global refMap
but are never removed.
Looks like a function to undo registerRef()
is missing in detached
unregisterRef: function() {
var idx = this.refMap[this.ref].indexOf(this);
if(idx >= 0)
this.refMap[this.ref].splice(idx, 1);
}
This is an issue because this prevents all the template instances of elements using core-style from being deallocated.
Since updating to 0.5.1
, I'm getting the error "WebComponents is not defined", coming from core-style.html
on line 268. It seems to work in Chrome, the error only appears in Firefox. What might cause this?
https://github.com/Polymer/core-style/blob/master/core-style.html#L268
It would be pretty neat if core-style could, instead of embedding a string of CSS within the core-style tag, include 1 or many link rel stylesheets that point to actual CSS files.
Looks like any space outside the parenthesis is converted to
<core-style id="main">
body {background-color:#000000;}
</core-style>
It's working fine on FF and Safari, but not on Chrome.
Here is the generated result:
<core-style id="main" hidden="">
"body {background-color:#000000;}"
</core-style>
ex.
<style is="core-style" type="polymer/style">
.span::before { content: "<script>alert(1)</script>"; }
</style>
Using today to do that will alert since it just has random HTML inside it which is both slower for the parser, and will interpret stuff inside it as tags. Instead it should work as above.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.