Intent to Remove: getMatchedCSSRules()

404 views
Skip to first unread message

Darren Shen

unread,
Aug 16, 2017, 3:03:38 AM8/16/17
to blink-dev

Primary eng (and PM) emails

sh...@chromium.org


Link to “Intent to Deprecate” thread

https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/fd-QLCiLESQ


Summary

Remove getMatchedCSSRules().


Motivation (from the Intent to Deprecate thread)

It's WebKit-only.

 

There's an open WebKit bug to remove it with relevant comments:

https://bugs.webkit.org/show_bug.cgi?id=79653


Mozilla has an open bug for this:

https://bugzilla.mozilla.org/show_bug.cgi?id=438278


This API does not have a spec.


Interoperability and Compatibility Risk

This API was introduced in WebKit in 2005 (see https://bugs.webkit.org/show_bug.cgi?id=79653). It was not implemented in either IE or Firefox. Edge has a stub implementation that only returns null.

 

Removing the API from Blink will cause exceptions to be thrown where it's used unconditionally (which will make it behave the same as Firefox and IE).


Alternative implementation suggestion for web developers

Unofficial Blink polyfill (adapted from Gecko polyfill): https://gist.github.com/darrnshn/addeabe2575177342cc6242e20ecadbd


This one says it can do what getMatchedCSSRules could do, but I have not personally tried it:

http://www.brothercake.com/site/resources/scripts/cssutilities/


More generally:

http://stackoverflow.com/questions/2952667/find-all-css-rules-that-apply-to-an-element


Usage information from UseCounter

At time of writing: 0.003%

https://www.chromestatus.com/metrics/feature/timeline/popularity/155


OWP launch tracking bug

N/A.


Entry on the feature dashboard

N/A.


Philip Jägenstedt

unread,
Aug 16, 2017, 9:42:42 AM8/16/17
to Darren Shen, blink-dev, me...@chromium.org
I'm excited to see this moving along!

I've turned htts://crbug.com/437569 into the launch bug for this. Can you create an entry on chromestatus.com?

At the time when getMatchedCSSRules() was deprecated, I didn't have a plan for when it would be removed, instead hopefully saying "Usage isn't zero and maybe the deprecation message will shake out some developer feedback on why they need the API."

The deprecation message has been there for a long time and there has been occasional feedback on the deprecation thread, but it's likely some have just been ignoring the message. So, I think that we should change the deprecation message to mention the time of removal for at least 2-3 milestones. What timeline for removal did you have in mind?

When it comes to the compat risk, it really comes down to what the usage out there looks like. +Eddy Mead, I know that you've already been digging in httparchive and doing some outreach. What I saw of that increased my hopes for successful removal by a lot, could you summarize that in some public place?

I also sent https://github.com/w3c/web-platform-tests/pull/6909 to add a negative test for this, it's a bit novel but I don't see why not.

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAMO7KM8V1%2B1r5N_dwtrN1iS47FZYeEQCFPvrKo%3DxH0pNWu9-Lg%40mail.gmail.com.

Chris Harrelson

unread,
Aug 24, 2017, 1:11:05 AM8/24/17
to Philip Jägenstedt, Darren Shen, blink-dev, Eddy Mead
Hi Eddy,

Any update on httparchive data to verify this removal is safe?

To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+unsubscribe@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAARdPYdPVjiknZSh8eXrgGvcwCk-q7CjsbfJ66y4j_G7qeSwSA%40mail.gmail.com.

Eddy Mead

unread,
Aug 24, 2017, 1:31:58 AM8/24/17
to Chris Harrelson, Philip Jägenstedt, Darren Shen, blink-dev
Ah, yes! I was asked to summarise it in a document, so I did that, but only shared it with Darren... Here it is now:


tl;dr:

After Blogger and Teads.tv removed their usages, the largest user returned in HTTPArchive was blueiconic.net followed by evernote.com, but inspecting their code suggests that they will not break if getMatchedCSSRules is removed (as it looks like they import a polyfill-type thing that checks if getMatchedCSSRules is defined, and defines it if not).

Chris Harrelson

unread,
Aug 24, 2017, 1:37:08 AM8/24/17
to Eddy Mead, Philip Jägenstedt, Darren Shen, blink-dev
This analysis looks promising, thanks! LGTM1

Philip Jägenstedt

unread,
Aug 24, 2017, 5:46:54 AM8/24/17
to Chris Harrelson, Eddy Mead, Darren Shen, blink-dev
Thank you Eddy, this is great!

This may just be a first or near-first where the breaking usage is highly concentrated, and outreach has been effective at decreasing usage, which is wonderful.

LGTM2

P.S. This is more due diligence and more carefully documented than we usually do. It's still OK to attempt removals with less effort than this. If this level were strictly required, I fear that might be a deterrent to attempting useful cleanup like this.

To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.

Rick Byers

unread,
Aug 24, 2017, 9:53:19 AM8/24/17
to Philip Jägenstedt, Chris Harrelson, Eddy Mead, Darren Shen, blink-dev
Awesome work!  LGTM3 assuming some >=2 milestone deprecation period (with a warning citing a specific removal milestone as normal).

To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+unsubscribe@chromium.org.

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+unsubscribe@chromium.org.

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.

Darren Shen

unread,
Aug 31, 2017, 12:56:02 AM8/31/17
to Rick Byers, Philip Jägenstedt, Chris Harrelson, Eddy Mead, blink-dev
Hi Rick, I believe this API has been deprecated with a warning message since 2014. However, I don't think we had a specific removal milestone. I'm aiming to remove this in M63. Is this okay?

To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.

Darren Shen

unread,
Sep 1, 2017, 1:42:20 AM9/1/17
to Rick Byers, Philip Jägenstedt, Chris Harrelson, Eddy Mead, blink-dev
I've modified the deprecation message to include the removal milestone of M63. The patch has landed in M62.

Rick Byers

unread,
Sep 1, 2017, 4:46:57 PM9/1/17
to Darren Shen, Philip Jägenstedt, Chris Harrelson, Eddy Mead, blink-dev
Yeah we want to give specific notice of removal (not specifying a date is basically permission to ignore the warning <grin>).  That plan sounds perfect to me.

To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+unsubscribe@chromium.org.

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+unsubscribe@chromium.org.

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
Reply all
Reply to author
Forward
0 new messages