RESOLVED CONFIGURATION CHANGED 62923
getComputedStyle doesn't work for pseudo elements on load
https://bugs.webkit.org/show_bug.cgi?id=62923
Summary getComputedStyle doesn't work for pseudo elements on load
Sam Weinig
Reported 2011-06-17 18:45:23 PDT
Created attachment 97679 [details] Test Case window.getComputedStyle() doesn't seem to work for pseudo elements until unload. It seems like the style is not available until it has been painted. Test case attached.
Attachments
Test Case (1.08 KB, text/html)
2011-06-17 18:45 PDT, Sam Weinig
no flags
[WIP] Patch (1.49 KB, patch)
2011-06-17 18:51 PDT, Sam Weinig
no flags
Sam Weinig
Comment 1 2011-06-17 18:48:03 PDT
This is probably what the comment in Element::computedStyle is referring to when it states: // FIXME: Find and use the renderer from the pseudo element instead of the actual element so that the 'length' // properties, which are only known by the renderer because it did the layout, will be correct and so that the // values returned for the ":selection" pseudo-element will be correct.
Sam Weinig
Comment 2 2011-06-17 18:51:43 PDT
Created attachment 97680 [details] [WIP] Patch This patch fixes the issue, but I am not sure it is the best the way to do it. I am also not certain what should be done about the case of the element not in the tree/with no renderer.
Ahmad Saleem
Comment 3 2023-01-12 04:51:11 PST
With attached test case, I am getting this across all browsers (Safari Technology Preview 160, Chrome Canary 111 and Firefox Nightly 110): In Script: rgb(0, 0, 0) On Load: rgb(0, 0, 0) On 100ms Timeout: rgb(0, 0, 0) Button Clicked: rgb(0, 0, 0) Is this still an issue? Thanks!
Anne van Kesteren
Comment 4 2023-12-24 02:40:09 PST
Seems like this was resolved indeed. The FIXME is also no longer present.
Note You need to log in before you can comment on or make changes to this bug.