Skip to content

Adopt hyperscript for html literals? #94

@mbostock

Description

@mbostock

Our html tagged template literal could be better. For example, it could support event listeners, style objects, and automatic escaping of text. And maybe we might also want a mechanism to do efficient updates, too.

There’s a lot of related open-source work in this area, to boot, particularly around hyperscript. Here’s a proof of concept, but there are lots of other libraries to consider (see the awesome-hyperscript list):

https://observablehq.com/d/1c3d8d85581a6bc9

The hard part here is that we can’t do this in a backwards-compatible way. So either we’ll need to introduce standard library versioning (which fortunately is easy relative to runtime versioning), or we’ll need to choose a new name, e.g. htm (but that won’t work for svg obviously). Either way it’s a bit tricky to change the behavior of a core standard library component.

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