Skip to content
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

window.getComputedStyle not returning correct style #1496

Open
jonathanmorley opened this issue Jul 25, 2024 · 0 comments
Open

window.getComputedStyle not returning correct style #1496

jonathanmorley opened this issue Jul 25, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@jonathanmorley
Copy link

jonathanmorley commented Jul 25, 2024

Describe the bug

The window.getComputedStyle function consistently returns an object looking like CSSStyleDeclaration { parentRule: null }, no matter the element passed in.

To Reproduce

import assert from "assert";
import { Browser } from "happy-dom";

const browser = new Browser();
const page = browser.newPage();

await page.goto('https://www.google.com');
await page.waitUntilComplete();

const style = page.mainFrame.window.getComputedStyle(page.mainFrame.document.body);

console.log(style);
assert.strictEqual(style.getPropertyValue('min-width'), '400px');
assert.strictEqual(style.getPropertyValue('font-size'), '14px');
assert.strictEqual(style.getPropertyValue('background'), '#202124');

Expected behavior
I expected the properties to reflect those from the HTML in https://www.google.com/.

Screenshots
image

Device:

  • OS: MacOS
  • Browser: Firefox
  • Version 128.0

Additional context
https://replit.com/@jonathanmorley/RichSandybrownCareware

@jonathanmorley jonathanmorley added the bug Something isn't working label Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant