In order to better support some of the upcoming features we need the facility to add additional HTML custom attributes (part of the HMTL5) spec. Here is a rough outline:
I think this would be a good time to introduce the concept for future work (we can decide if we want to rewrite existing code later).
Should be easy to implement:
- Add Map<String, String> data to ComponentBase (and Component interface)
- In attributeBuilding.tag, build up a new data variable. This would read the map entries and for each entry add the attribute with 'data-
"' to the variable string.
- Pick up the new variables from span, div tag builders and other templates after call to attributeBuilder
Then in the script tag pass the component and call attributeBuilder, then adding the data variable would result in:
<input type="hidden" data-role="script" data-for="u99"/>
Then when doing refresh on the component we can find its script with:
jq('hidden[data-role="script"][data-for="' + componentId + '"])