Skip to content

Support linking module to body and single element #64

@DrSensor

Description

@DrSensor

link module to <body>

<head>
  <script src=//esm.run/nusa/link/root></script>
</head>

<link let=root href=module.js>
<link target="input[type=button]" href=counter.js>

<body>
  <input :=root.Log type=text :: value:=root.msg placeholder:=root.default>
  <input :=root.Log type=button :: value:=count on:click=increment>
</body>

link module to specific element

<script src=//esm.run/nusa/link/element></script>

<input :=io.Log
 type=text
 ::="<link scope=self let=io href=module.js>"
 value:=io.msg
 placeholder:=io.default
>

🤔 Question: should the default (when no scope attribute) binding pass to children too like in render-scope > template[shadowrootmode] *

Possible value for scope attribute:

  • self - querySelector(:scope) or same as this Element
  • child - querySelectorAll(:scope > *)
  • inside - querySelectorAll(:scope *)
  • all - querySelectorAll(:scope, :scope *)

Metadata

Metadata

Assignees

No one assigned

    Labels

    data bindingEverything related to data bindingenhancementNew feature or request

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions