Description
Background
For some context that inspired this request, currently working on a site using XHP for server-side HTML rendering. Looked into progressive enhancement frameworks for JS and found one I really liked called Unpoly. The way it works is by annotating the HTML with custom special attributes prefixed with up-
(e.g. up-target
, up-expand
, etc.).
Motivation
XHP does support custom attributes already (data-
and aria-
) but there is no way to extend this list if there's a desire for more.
The only existing way I can think of doing this is by basically reimplementing all of the core XHP HTML elements by extending some new like "base up element" that enumerates all the attributes and then just smearing the HTML element attributes and extend via composition.
If there's some other way to do this, that'd be great. But otherwise, would it be possible to add this?
Proposal
In my mind, this would be a new HHVM INI config option that can be used to add additional special attribute prefixes. Something like hhvm.xhp.special_attribute_prefixes
which is configured with a default of keyset['data-', 'aria-']
I'd then just be able to modify my INI file with:
hhvm.xhp.special_attribute_prefixes[] = 'up-'
and I don't have to do any additional code. I can just use the attributes right away.