Allow custom value and modifier operators - #4899
Conversation
…modifier or end of the attribute name
|
Thanks for the thoughtful PR. I'm going to pass on this one. The core parser can be made operator-agnostic, but the Good news is your use case already works via <button x-bind="{ '@click'() { foo = 'baz' } }">Separately, |
|
Thank you for taking a look. It definitely seems like things are not in a good state right now to allow this change. This does bring up some internal issues though, which may need to be addressed at some point. For example, user provided values being used in regexes without being escaped. Also, I did not realize so many things read the directive names directly. That seems like something that should probably be refactored over time so that only the core package is handling parsing of the directives and/or selection based on attributes instead of relying on manual |
|
@calebporzio also, thank you for the tip about |
This exposes new
useModifierOperatoranduseValueOperatorfunctions that allows the default value (:) and modifier (.) operators to be swapped out.I ran into an issue with a page builder I was using, where it allowed custom attributes, but sanitized the attribute names according to what is allowed for valid HTML. This meant that all values and modifiers were stripped off. If I was able to specify the operators manually for this installation, I would have been able to use Alpine without any issue.
Example: