Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create dev tools and css map tool #1216

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

marcustyphoon
Copy link
Collaborator

Description

I have, like, zero opinion about what any of this is called, what format it uses, whatever.

The notable choice we have here is whether to:

  • use pageModifications, which has slightly less performance impact but will fail on elements that Tumblr updates the classList of (like when you switch dashboard tabs and the tab elements become highlighted/unhighlighted
  • use a mutation observer with attributeFilter: ['class'] and just querySelector the whole damn document, which is technically slower (though I run this as a userscript 100% of the time; the performance hit is not noticable)
  • use a mutation observer with attributeFilter: ['class'] and parse the mutationRecord (fancy~)

Testing steps

@AprilSylph
Copy link
Owner

third option plz ❤️

@marcustyphoon
Copy link
Collaborator Author

marcustyphoon commented Aug 18, 2023

Aw man.

I had this cute idea to add attribute change observation as an option for registering page modification handlers with our regular util, but that would probably only be a good idea if one could disable the mutation observer while we set classnames on stuff (and enable it again afterward) so that you don't get a cascading waterfall of onBeforeRepaint calls or whatever. But a) we usually do modifications asynchronously, so they're not actually inside onBeforeRepaint, and b) while I don't know of any way that a pageModifications handler could result in Redpop synchronously adding an element (which would then not get detected, if the observer was disabled), I'm not confident enough in that to potentially break XKit Rewritten for no actual reason*.

*besides that my weird alt text reminder PR would lose a few lines of code maybe

@marcustyphoon
Copy link
Collaborator Author

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants