Special:GadgetUsage is our friend.
Plus, mwgrep on wikis in the javascript namespace.
Gadgets and User Scripts on enwp
edit- most gadgets: don't necessarily inspect HTML -- 30% maybe use actual HTML most things might look for ids ...
- taking an inventory of gadgets
- no reliable way of knowing how user scripts ...
- a few gadgets everyone uses: popup, hotcat, (5 or so) ... ppl post in village pump in < 30 mins if broken
- some 20 or 30 that a few more ppl use and will take a while
- last category: used for specialized processes .. about 100
- page lists a lot of them