Re: [csswg-drafts] [css-pseudo-4] Add discussion of properties from the originating element (#9428)

> Alright, question I'm not entirely clear on: what is the result of getComputedStyle() for `font-size` and `border-width` on the highlight pseudo given:
> 
> ```
> p { font-size: 20px; border-width: 10px; }
> p::selection { font-size: 30px; border-width: 20px; }
> ```
> 
> ?

Sorry I missed this way back. In any event. getConputedStyle in Chrome reports the originating element's font size because the font size in the selection pseudo is never applied and the font size is set from the originating element always.

<html>
<style>
p { font-size: 20px; border-width: 10px;  border-style: solid; border-color: green;}
p::selection { font-size: 30px; border-width: 20px; border-style: solid; border-color: green;}
</style>
<body>
<p id="x">Hello world</p>
</body>
</html>

getComputedStyle(x, ":selection").fontSize
> 20px

The border properties are defaults, e.g. borderTopWidth > 0px.

-- 
GitHub Notification of comment by schenney-chromium
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/pull/9428#issuecomment-1877811739 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 4 January 2024 21:54:27 UTC