leonidas / transparency

Transparency is a semantic template engine for the browser. It maps JSON objects to DOM elements by id, class and data-bind attributes.
http://leonidas.github.com/transparency/
MIT License
969 stars 112 forks source link

Elements not cleared when rebinded with new data #153

Open ibiza240 opened 6 years ago

ibiza240 commented 6 years ago

Hi and thanks for this lightweight library, I tried it and liked it!

However I found a bug, here is my scenario. I have a button to make an AJAX call and bind the JSON data from the server to HTML elements with Transparency.

First time, let's say element1 and element2 are populated correctly with the following json: { element1: 'abc', element2: 'def' }

If I do a second AJAX call that returns something null in element2, the value 'def' will still be seen on the webpage, along with the new value for element1.

This pretty much breaks it for me...is this a known bug?

Thanks! Bruno