Add optional alternative sx-[attribute] binding syntax
#3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces an alternative, more concise binding syntax that can optionally be used instead of the standard binding descriptor
data-bind-attrstyle, as suggested by the proposal here.This alternative style takes the format
sx-[attributeName]="identifier#propertyName". In contrast to the regular syntax, the name of the attribute to bind to the value is part of the descriptor attribute name, rather than being specified as part of the attribute value.Similarly, text content and inner HTML bindings can be applied using
sx-textandsx-htmlattributes in place of the standarddata-bind-textanddata-bind-htmlattributes, if desired.Both syntaxes are always supported on all elements. There is no configuration required to switch between the two styles.
Customising the attribute prefix
The attribute prefix (by default
sx-) can be customised when initialising StimulusX if required.