Skip to content

Attach event handlers based on HTML data attributes#608

Open
rsek wants to merge 8 commits into
ben:mainfrom
rsek:data-on
Open

Attach event handlers based on HTML data attributes#608
rsek wants to merge 8 commits into
ben:mainfrom
rsek:data-on

Conversation

@rsek

@rsek rsek commented Jan 23, 2023

Copy link
Copy Markdown
Collaborator

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

rsek commented Jan 25, 2023

Copy link
Copy Markdown
Collaborator Author

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

@ben ben left a comment

Copy link
Copy Markdown
Owner

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