-
Notifications
You must be signed in to change notification settings - Fork 94
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
More fine-grained parsing of data attributes #219
Comments
data-*
attributesdata-*
data-*
data-*
I think this way lies madness. There's too many edge cases to do this properly probably. If you don't want name space clashing
Class.name = 'clazz' Now have data-clazz |
I’m going to push back on this. If the attribute plugin’s name is |
data-*
Proof-of-concept in Before: if (p.mustHaveEmptyKey && key.length > 0) {
// must have empty key
throw ERR_BAD_ARGS;
}
if (p.mustNotEmptyKey && key.length === 0) {
// must have non-empty key
throw ERR_BAD_ARGS;
} After: if (!p.canHaveKey && key.length > 0) {
// skip
continue;
}
if (p.mustHaveKey && key.length === 0) {
// must have a key
throw ERR_BAD_ARGS;
} |
i still have a major problem with trying to maintain this separation... we may add modifiers in the future, we can "solve" this for now but it seems like a game of whack a mole |
yeah, this is a valid point, but i meant more trying to avoid name clashes... as the data-* first framework they can change if there is a "real" clash. this change makes sense to me |
We agreed that we want to keep the possibility of using |
Reopening to explore whether there’s a case for not throwing an error, for better compatibility with other libraries. |
Decided that we’re going with throwing errors instead of failing silently, so the only way forward for allowing |
Someone reported having a data attribute collision between a Craft plugin they use and Datastar. The plugin uses
data-show-processing-spinner
to mark elements as processing., which results in this error.@delaneyj put aside any thoughts of “forms are bad”, because this is a plugin for collecting user input from the frontend. So it is less about forms and more about dealing with naming collisions.
Would it be possible to get rid of
mustHaveEmptyKey
and replacemustNotEmptyKey
withmustHaveKey
? That way,data-show-processing-spinner
will not be confused with thedata-show
attribute.The text was updated successfully, but these errors were encountered: