2 var ruleCache = new Set()
4 function createStyleNode() {
6 const node = document.createElement('style')
7 // Without it, IE will have a broken source order specificity if we
8 // insert rules after we insert the style tag.
9 // It seems to kick-off the source order specificity algorithm.
10 node.textContent = '\n'
11 document.head.appendChild(node);
16 var staticSheet = createStyleNode();
17 var sheet = createStyleNode().sheet;
21 function sync_static(newStyleString) {
22 staticSheet.textContent = newStyleString
25 function sync(newStyles) {
26 Object.keys(newStyles).forEach((key) => {
27 if (!ruleCache.has(key)) {
28 const newRule = newStyles[key]
29 for (var i = 0; i < newRule.length; i++) {
30 sheet.insertRule(newRule[i])
38 class CssRulesNode extends HTMLElement {
43 sync(this.rulesPayload)
46 console.log("set rules")
48 if (self.rulesPayload) {
49 console.log(self.rulesPayload)
52 console.log(this._rules)
54 attributeChangedCallback(attrName, oldVal, newVal) {
55 console.log(attrName, oldVal, newVal)
58 customElements.define('elm-ui-rules', CssRulesNode);
62 class CssStaticRulesNode extends HTMLElement {
68 // console.log("static connected")
71 // sync_static(this._rules)
76 sync_static(this._rules)
77 // console.log("set static rules")
81 attributeChangedCallback(attrName, oldVal, newVal) {
82 console.log("attribute cng")
84 if (attrName == "rules") {
89 customElements.define('elm-ui-static-rules', CssStaticRulesNode);
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list