The data-is attribute is not updated for dynamic tags #2037

GianlucaGuarini opened this Issue Oct 19, 2016 · 2 comments


None yet

3 participants

GianlucaGuarini commented Oct 19, 2016 edited

Please check the example
The data-is attribute should be updated using the new tag name in order to be styled properly

@GianlucaGuarini GianlucaGuarini added this to the 3.0.0 milestone Oct 19, 2016
vitogit commented Oct 20, 2016

I tried to fix this. I think the problem is that the data-is is not updating the value when the update() is executed. If we force it, it will work. In your sample, using setAttribute

  <div ref="divi" data-is={ child }></div>

    onClick() {
      this.child = this.child === 'foo' ? 'bar' : 'foo'

I tried to look at the riot source, and created this minimal test

  it.only('data-is value is dynamically updated', function() {
    var tag = riot.mount('dynamic-data-is')[0]
    var singleTag = tag.refs.singleTag
    tag.single = 'color'

with the tag:



  <div ref="singleTag" data-is={single}></div> 
  this.single = 'calendar'
  change_data() {
    this.single = 'color'

I think that in updateExpression from lib/browser/tag/update.js we should access the data-is property and set it, but I don´t know how riot reach that tag from the code.

How the update method works? It´s iterate over the element attributes? because I added some console.logs and saw that it access the ref attribute but not the data-is attribute.

Is there a way to debug the riot code better that using logs anywhere? I tried the karma debug, but it uses the minified version and is hard to follow. Any suggestion?

@rsbondi rsbondi self-assigned this Oct 23, 2016
rsbondi commented Oct 23, 2016


@rsbondi rsbondi added the fixed label Oct 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment