agility icon indicating copy to clipboard operation
agility copied to clipboard

data-bind with class should not clobber the agility class of root element

Open cdrubin opened this issue 11 years ago • 2 comments

First-off: Thank you for a great framework! :)

var $$item = $$( {
  model: {
    type: 'document' 
  }, 
  view: { 
    'format': '<li data-bind="name, class=type">', 
    'style': '& { background-color: green }'
  } 
} );

should result in this HTML :

<li class=".agility_X document" data-bind="name, class=type"></li>

but instead clobbers the .agility_X class and results in :

<li class="document" data-bind="name, class=type"></li>

cdrubin avatar Sep 05 '13 20:09 cdrubin

I see even more clobbering happening:

var $$item = $$( {
  model: {
    button_text: 'submit' 
  }, 
  view: { 
    'format': '<a data-bind="button_text"><img src="something.png" /></a>'
  } 
} );

should result in the HTML :

<a data-bind="button_text"><img src="something.png" />submit</a>

but instead clobbers the child element and results in :

<a data-bind="button_text">submit</a>

Is this intentional? Same for the first issue, is this somehow desirable and I am missing the purpose?

cdrubin avatar Sep 16 '13 22:09 cdrubin

@cdrubin, yes, I believe this second example is intentional. Try moving the data-bind to a <span> inside the <a>.

robertjustjones avatar Sep 16 '13 23:09 robertjustjones