-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider adding support in WebIDL for defining template tags #631
Comments
Something like |
A couple missing things there:
|
AFAIK tagged template functions are just functions, so we may just need a way to define general global (or module level) functions. |
You can make global functions by defining operations in a global interface. For modules, see #592 . |
Is there something preventing you from just using the normal operations syntax for template tags? |
@domenic Well, you'd need to take it in as an |
Wouldn't just |
Yeah, that could work for some things. Some additional things that would be nice to do in a template tag:
|
Slightly off-topic for webidl, but since you tagged me: I think the most interesting future direction is for JS to allow host-defined tags that are not identifiers so that the host can switch parsers for the template literal contents before evaluating any JS. We're running out of syntactic space, but imagine that: let title = (text) => #html`<h1>${text}</h1>`; invoked the host-defined parser for |
Possible place to follow up on this idea: https://github.com/littledan/proposal-reserved-decorator-like-syntax |
The ES6 feature of tagged template strings has recently been catching on in JavaScript. We may want to add Web APIs which define template tags in the near future, e.g., for Trusted Types, to test literal-ness (cc @koto) or for a built-in version of something like the parsing part of lit-html (cc @justinfagnani).
Would it make sense to add support to WebIDL to add template tags? What would that look like?
The text was updated successfully, but these errors were encountered: