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

FYI: textarea behavior is very funky if you try to put HTML inside it rather than using the 'value' attribute #71

Open
irskep opened this issue Apr 23, 2023 · 2 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@irskep
Copy link

irskep commented Apr 23, 2023

I tried doing this:

  import { reactive, html } from 'https://esm.sh/@arrow-js/core';
  const data = reactive({value: "123"})
  html`
  <textarea>${() => data.value}</textarea>
  `(document.body);

As you may already know, it doesn't work:

Screen Shot 2023-04-22 at 8 26 09 PM

However, the workaround (use the value attribute) isn't documented in a way that would have pointed me at the correct behavior. I pieced it together from the changelog and an unrelated GitHub issue.

@irskep irskep changed the title FYI: textarea behavior is very funky FYI: textarea behavior is very funky if you try to put HTML inside it rather than using the 'value' attribute Apr 23, 2023
@peacememories
Copy link

These are the delimiters placed inside the html string by the t function to help find the places stuff needs to be bound to in the DOM. Since the <textarea> element looks like an element that takes children, but actually only takes text, the usual way to strip these comments out of the generated DOM don't work I think. This could probably be fixed (or a warning could be introduced) in the fragment function. Of course I've only just begun reading through the code as an outsider 😅

@justin-schroeder
Copy link
Owner

Hmm, good point....this could use a bit of additional work.

@justin-schroeder justin-schroeder added bug Something isn't working enhancement New feature or request labels May 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants