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

Attach event handlers based on HTML data attributes #608

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

rsek
Copy link
Collaborator

@rsek rsek commented Jan 23, 2023

Draft to explore a more structured approach to applying event listeners. It prefers data attributes like data-on-click="methodName" so that programmatically relevant data has its own bucket, rather than living with styling information. Practically speaking, that should make it safer to e.g. monkey with CSS classes without accidentally breaking a button.

  • standardize naming with function conventions e.g. verbNoun, and make the methods correspond to these
  • update changelog
  • develop a function (or a class mixin?) to standardize adding "on event, do method()" listeners to be addressed in its own PR

@rsek rsek marked this pull request as ready for review January 25, 2023 02:06
@rsek
Copy link
Collaborator Author

rsek commented Jan 25, 2023

i reckon that i can build on this, but it's quite mergeable as-is, so let's do that. i don't need more long-running PRs, haha

@rsek rsek requested a review from ben January 25, 2023 02:09
Copy link
Owner

@ben ben left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it. If you've manually tested every one of these changes, go ahead and merge it!

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.

2 participants