We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
js控制伪元素样式 原文链接
<!DOCTYPE html> <title>CSS</title> <style> body { font: 200%/1.45 charter; } ref::before { content: '\00A7'; letter-spacing: .1em; } </style> <article>The seller can, under Business Law <ref>1782</ref>, offer a full refund to buyers. </article> <script> function ruleSelector(selector) { function uni(selector) { return selector.replace(/::/g, ':') } return Array.prototype.filter.call(Array.prototype.concat.apply([], Array.prototype.map.call(document.styleSheets, function(x) { return Array.prototype.slice.call(x.cssRules); })), function(x) { return uni(x.selectorText) === uni(selector); }); } var toggle = false, pseudo = ruleSelector("ref::before").slice(-1); document.querySelector("article").onclick = function() { pseudo.forEach(function(rule) { if (toggle = !toggle) rule.style.color = "red"; else rule.style.color = "black"; }); } </script>
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The text was updated successfully, but these errors were encountered: