-
Notifications
You must be signed in to change notification settings - Fork 120
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
Support document.styleSheets? #50
Comments
I would actually like to support more of the CSS-related DOM eventually. Patches welcome! Otherwise I'll eventually get to it myself. |
I've been doing a lot of work on https://github.com/CSSLint/parser-lib recently, so we're close(r) to being able to implement this properly. (We do already implement CSSStyleDeclaration which is the value of the |
Firstly, thanks for the great lib! Secondly, I wanted to add a comment for posterity :] Maybe this goes without saying for some, but I think this issue also applies generally to all styles specified in /* foo.css */
.foo {
color: red;
} <!-- fixture.html -->
<html>
<head>
<link href=foo.css rel=stylesheet>
<style>
.bar {
background: green;
}
</style>
</head>
<body>
<a id=a class='foo bar' style='font-size: 20px'>hello world!</a>
</body>
</html> Color and background are undefined: var domino = require('domino')
var fs = require('fs')
var html = fs.readFileSync('fixture.html')
var window = domino.createWindow(html)
var a = window.document.getElementById('a')
var style = window.getComputedStyle(a)
console.log(a.classList) // foo, bar
console.log(style.getPropertyValue('color')) // undefined
console.log(style.getPropertyValue('background')) // undefined
console.log(style.getPropertyValue('font-size')) // 20px It's a little bit of bummer if your code relies on |
@cscott Is there an implementation plan for this feature (and other We're running into this issue trying to get SSR to work properly on |
I run into this issue when trying to generate graph on serverside using d3 and domino. The inline style which is set by eg: |
Not sure if it's out of scope for the project, but I ran into an issue with an automated headless test that is accessing
document.styleSheets
. This is needed since it's the only way to get at thestylesheet.rules
, etc properties (which I'm guessing isn't supported either).The text was updated successfully, but these errors were encountered: