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

can't setting attribute in root element #289

Closed
bcw104 opened this issue Feb 3, 2015 · 7 comments
Closed

can't setting attribute in root element #289

bcw104 opened this issue Feb 3, 2015 · 7 comments
Labels

Comments

@bcw104
Copy link

bcw104 commented Feb 3, 2015

the root element in tag files does not support attribute setting:

<todo class="my-theme">

  <!-- layout -->
  <h3>{ opts.title }</h3>

  <ul>
    <li each={ item, i in items }>{ item }</li>
  </ul>

</todo>
@txchen
Copy link
Contributor

txchen commented Feb 4, 2015

+1 to support setting attribute on root el will be useful for styling.

@inetfuture
Copy link

+1

@cognitom cognitom mentioned this issue Feb 4, 2015
@tipiirai
Copy link
Contributor

This should definitely be supported.

Also planning adding some sort of attribute validation to the root attributes.

@GianlucaGuarini GianlucaGuarini mentioned this issue Apr 26, 2015
15 tasks
@lukescott
Copy link

Any workaround for this?

<input />
<script type="riot/tag">
  <input onchange={this.changeEvent}>
      this.changeEvent = function() {
          console.log(this);
      }
  </input>
</script>

I have to setup two-way binding with a library and this issue is preventing me from doing so. I think this.root.addEventListener is probably not cross-browser as the onchange event is in Riot.

@tipiirai
Copy link
Contributor

tipiirai commented May 5, 2015

Try following:

<custom-input></custom-input>

<script type="riot/tag">
  <custom-input>
    <input onchange={ changeEvent }>

    changeEvent() {
      console.log(this);
    }
  </custom-input>
</script>

@jzempel
Copy link

jzempel commented Jun 22, 2015

so @tipiirai, according to your last comment it seems riot will support attributes on the root tag but not events. Is that correct? Do you expect this to change in the future?

@tipiirai
Copy link
Contributor

I think root attributes should be fully supported, but cannot give you any ETA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants