Skip to content
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

Support linking module to body and single element #64

Open
DrSensor opened this issue Mar 20, 2023 · 0 comments
Open

Support linking module to body and single element #64

DrSensor opened this issue Mar 20, 2023 · 0 comments
Labels
data binding Everything related to data binding enhancement New feature or request
Milestone

Comments

@DrSensor
Copy link
Owner

DrSensor commented Mar 20, 2023

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 *)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data binding Everything related to data binding enhancement New feature or request
Development

No branches or pull requests

1 participant