8000 [Request] Custom special attributes · Issue #303 · hhvm/xhp-lib · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Apr 1, 2024. It is now read-only.
This repository was archived by the owner on Apr 1, 2024. It is now read-only.
[Request] Custom special attributes #303
Open
@Kilenaitor

Description

@Kilenaitor

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0