Interactivity API: Improve readability in directives check function inside `vdom.ts`
This section could probably use some comments about how strings are being split up and what we expect to find in each part. We've even got a constant `wp` that's the `directivePrefix` (that also appears in the middle of the data attribute).
Honestly, some kind of description of what the parts of a directive are and a refactor to rename things accordingly would be helpful. prefix and suffix don't really make sense:
nothing? suffix is everything after `prefix--`… I guess this makes sense
| |
vvvvvvv vvvvvvvvvv
data-wp-bind--on--change
^^^^
|
"prefix" in the middle?
Maybe we could talk about these things like the "directive name" or "directive type", then the rest of it could be some kind of input to the directive? I think we use these prefix/suffix names across the package and it seems confusing.
The bug fix here where we try to access a null match is good 👍
Originally posted by @sirreal in https://github.com/WordPress/gutenberg/pull/61249#discussion_r1592540765
Hi @cbravobernal, I have added the general comment for this issue in this PR. Please let me know if we need to update it with some other content.
Thank you!
Hi @cbravobernal
, I have added the general comment for this issue in this PR. Please let me know if we need to update it with some other content.
Thank you!
Thanks for contributing!
I left some feedback, but I would love more input for other folks.
Naming variables is a tough task! 😅
Finally I decided we are not going to go with this issue/PR. The terms prefix and suffix appears through all Interactivity codebase , and is not something we can change slightly.