happy-dom icon indicating copy to clipboard operation
happy-dom copied to clipboard

Unlike real browsers, getComputedStyle(...).direction does not take `dir` attribute into account

Open divdavem opened this issue 1 year ago • 0 comments

Describe the bug To match the behavior in real browsers, happy-dom should use the dir attribute when returning getComputedStyle(...).direction.

To Reproduce

Execute the following code in happy-dom environment:

const getTextDirection = (element) => getComputedStyle(element).direction;
const element = document.body.appendChild(document.createElement("div"));
element.setAttribute("dir", "rtl");
console.log("direction = " + getTextDirection(element));

direction = ltr is logged.

Expected behavior direction = rtl should be logged. That's what happens in Chrome (tested in version 118.0.5993.70 (Official Build) (64-bit)) and Firefox (tested in version 118.0.2 (64-bit)).

I am using happy-dom version 12.9.1.

divdavem avatar Oct 13 '23 08:10 divdavem