-
-
Notifications
You must be signed in to change notification settings - Fork 926
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
v2.2.10 Breaks CSS text in happy-dom/vitest? #2989
Comments
Could you provide code to reproduce your error? Your "Code" section just contains error info, which isn't the purpose of the section. |
It's a bit complicated as you need to have vitest and happy dom setup, something like this might work:
|
@thequailman Could you slap together a repo with instructions? Was hoping for something self-contained. |
It seems that happy-dom does not support the setting to style dashed-properties unlike other real browsers and jsdom. happy-dom example (can not set via dashed-property) // happy-dom
const { Window } = require('happy-dom');
const window = new Window();
window.document.body.innerHTML = '<p>Hello world</p>';
const element = window.document.querySelector("p");
console.log(element.textContent) // Hello world
// not supported (against spec.)
element.style["font-size"] = "10px"
// supported
// element.style.fontSize = "10px"
// element.style["fontSize"] = "10px"
// element.style.setProperty("font-size","10px")
// unintended support (cssText is "fontSize: 10px;")
// element.style.setProperty("fontSize","10px")
console.log(element.style.cssText); // no prints jsdom example (can set via dashed-property) // jsdom
const jsdom = require("jsdom");
const { JSDOM } = jsdom;
const dom = new JSDOM(`<!DOCTYPE html><p>Hello world</p>`);
const element = dom.window.document.querySelector("p");
console.log(element.textContent) // Hello world
// supported
element.style["font-size"] = "10px"
// element.style.fontSize = "10px"
// element.style["fontSize"] = "10px"
// element.style.setProperty("font-size","10px")
// not supported (No problem, as it behaves according to the spec.)
// element.style.setProperty("fontSize","10px")
console.log(element.style.cssText); // prints "font-size: 10px;" @dead-claudia It might be better to change to a variation using includes() or indexOf(), as the old proposal in #2985. |
Reported that happy-dom example in capricorn86/happy-dom#1613 as they claim to (be trying to) implement a full headless web browser. I'm still open to a fix for this, but do note that our internal mocks are not supported for general use (and haven't been for a long time). |
Is there an existing issue for this?
Mithril.js Version
2.2.10
Browser and OS
Vitest
Project
No response
Code
Steps to Reproduce
Using vitest or happy-dom, getElement and check the style.cssText value.
Expected Behavior
It should return the CSS values, I think.
Observed Behavior
Empty string is always returned.
Context
Breaks a bunch of my tests.
The text was updated successfully, but these errors were encountered: