Commit 77b83891 authored by Nellie McKesson's avatar Nellie McKesson

making updates per Freds notes

parent 758d9527
......@@ -17,7 +17,7 @@ class NthOfType extends Handler {
let declarations = csstree.generate(ruleNode.block);
declarations = declarations.replace(/[{}]/g,"");
let uuid = UUID();
let uuid = "nth-of-type-" + UUID();
selector.split(",").forEach((s) => {
if (!this.selectors[s]) {
......@@ -41,17 +41,17 @@ class NthOfType extends Handler {
let elements = parsed.querySelectorAll(s);
for (var i = 0; i < elements.length; i++) {
let dataCssRule = elements[i].getAttribute("data-css-rule");
let dataNthOfType = elements[i].getAttribute("data-nth-of-type");
if (dataCssRule && dataCssRule != "") {
dataCssRule = `${dataCssRule},${selectors[s][0]}`;
elements[i].setAttribute("data-css-rule", dataCssRule);
if (dataNthOfType && dataNthOfType != "") {
dataNthOfType = `${dataNthOfType},${selectors[s][0]}`;
elements[i].setAttribute("data-nth-of-type", dataNthOfType);
} else {
elements[i].setAttribute("data-css-rule", selectors[s][0]);
elements[i].setAttribute("data-nth-of-type", selectors[s][0]);
}
}
let rule = `*[data-css-rule*='${selectors[s][0]}'] { ${selectors[s][1]}; }`;
let rule = `*[data-nth-of-type*='${selectors[s][0]}'] { ${selectors[s][1]}; }`;
this.styleSheet.insertRule(rule, this.styleSheet.cssRules.length);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment