Re: [csswg-drafts] [cssom-1][css-pseudo-4] getComputedStyle and pseudo-elements with pseudo-classes or sub-pseudo-elements (#10297)

I've also investigated this issue, and here is my opinion:

> 1. **Should `getComputedStyle(x, "::search-text")` return the `:current` styles or the `:not(:current)` styles?** We propose `:not(:current)`, and specifying this behaviour for ::search-text in [css-pseudo #getComputedStyle](https://drafts.csswg.org/css-pseudo/#getComputedStyle).

I agree with this because we need to stick to the current behavior of [getComputedStyle()](https://drafts.csswg.org/cssom-1/#dom-window-getcomputedstyle) for [highlight pseudo-element](https://drafts.csswg.org/css-pseudo/#highlight-pseudo-element). 
It returns styles as if that highlight is active and all other highlights are inactive.

> 2. **Given that `getComputedStyle(x)` returns the `:hover` styles when x is being hovered, should `getComputedStyle(x, "::first-line")` return the `::first-line:hover` styles when the first line is being hovered?** My current belief is that it should, and that in general, getComputedStyle should take pseudo-classes of the given pseudoElt into account. Note that ::first-line:hover rules are [not yet supported by major impls](https://stackoverflow.com/a/78084258) ([demo](https://bucket.daz.cat/work/igalia/0/66.html)).

I agree with this. 
In addition, I found [a request to support this feature from WICG](https://github.com/WICG/proposals/issues/107).

I also think it would be nice if `getComputedStyle(x, ":target::target-text")` returns style of the element selected by `:target::target-text`. 
It seems the browser returns `null` in this case now.
Here is the [demo](https://jihyerish.github.io/demos/target-text/main.html) related to this.
(Note: demo works in Chrome and Edge. Firefox and Safari don't support `target-text` yet)

> 3. **Can we give authors a way to get the `::search-text:current` styles?** My current belief is that we should change pseudoElt from `<pseudo-element-selector>` to `<pseudo-compound-selector>`, but I’m not yet sure how we would update the algorithm in a way that satisfies both my beliefs in question 2 and question 3.
> 4. **Can we give authors a way to get the `::before::marker` styles?** My current belief is that we should change pseudoElt to `<pseudo-element-selector>+` or `<pseudo-compound-selector>+`, depending on the outcome of question 3.

I also think that changing pseudoElt from `<pseudo-element-selector>` to `<pseudo-compound-selector>` for [`getComputedStyle(elt, pseudoElt)`](https://drafts.csswg.org/cssom-1/#dom-window-getcomputedstyle) is reasonable way to approch.


-- 
GitHub Notification of comment by jihyerish
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10297#issuecomment-2188015313 using your GitHub account


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

Received on Tuesday, 25 June 2024 05:33:39 UTC