Community Wishlist Survey 2021/Miscellaneous/Add a tracker for CSS selectors

Add a tracker for CSS selectors

  • Problem: We don't have a query service for searching CSS selectors (e.g. id and classes). It makes really hard to clean up the legacy codes. Because of that, it took several years to supersede deprecated "prettytable" class in Commons. Until the legacy selectors are completely eliminated, we must keep the legacy codes for really long time. Also, we are not able to evaluate the impact of the style modifications.
  • Who would benefit: interface administrators and developers, template editors
  • Proposed solution: Add a special page to search pages using the specific id or class selectors
  • More comments:
  • Phabricator tickets:
  • Proposer: – Kwj2772 (msg) 14:56, 18 November 2020 (UTC)Reply[reply]


  • Hello Kwj2772! You should be able to identify use of CSS selectors by simply doing a insource search. For example, here is an example of where I'm searching for the wpFilterRules selector (I intentionally did not include the # (ID) symbol in case there was some JavaScript that used for instance document.getElementById()). You can also search via regular expression. If you need to search across multiple wikis, try the Global Search tool. That tool has a convenient link to search only JS/CSS/JSON as well. It also supports regular expressions, among other features. Do any of these solutions work for you? MusikAnimal (WMF) (talk) 21:33, 18 November 2020 (UTC)Reply[reply]
    • Difficult point still exists when the classname is defined in common words. For example, you would have much trouble when you have to find the classname "notice". – Kwj2772 (msg) 09:44, 19 November 2020 (UTC)Reply[reply] for example seems to work well. The regular expression could be tweaked to be more strict, if needed. I'm not sure how would we even be able to track use of IDs/selectors. MusikAnimal (WMF) (talk) 22:30, 23 November 2020 (UTC)Reply[reply]
      @MusikAnimal (WMF): You can search on content model which I usually prefer: like so. As for intitle, the period is one of those 'unimportant characters', so it's just as easy to remove the period for intitle searches. (Regex is slightly supported there, but I've found contentmodel to do the best job of finding the CSS pages I care about.) --Izno (talk) 16:07, 11 December 2020 (UTC)Reply[reply]
  • Kwj2772, what I have been doing recently is a search like this: insource:infobox insource:class insource:/class[^}]{0,25}infobox/ prefix:A. Basically, looks for insource:infobox and insource:class, then also insource:class followed by no template-end characters up to 25 times, then the word infobox, for all pages that start with A. Hope this helps in your future. --Izno (talk) 16:02, 11 December 2020 (UTC)Reply[reply]


  •   Support Support for convenience. MarioSuperstar77 (talk) 19:35, 8 December 2020 (UTC)Reply[reply]
  •   Oppose insource: already does this. Devs should not reinvent the wheel.  — SMcCandlish ¢ >ʌⱷ҅ʌ<  07:11, 15 December 2020 (UTC)Reply[reply]
  •   Oppose insource: (and Global Search) should suffice for 99-100% of cases. I have succesfully removed prettytable from numerous wikis using this feature, and not once heard about missed cases after the fact. Worst case scenario, an lesser-styled table still functions well, so the damage is minimal and easy to improve for most editors. Granted, that's merely a worst case scenario, which I have not yet encountered in practice. --Krinkle (talk) 03:51, 21 December 2020 (UTC)Reply[reply]