Code Monkey home page Code Monkey logo

Comments (4)

DanRoche avatar DanRoche commented on June 22, 2024 1

from dna-engine.

dpilafian avatar dpilafian commented on June 22, 2024

This bug is because the location of the template within the container is determined by simply looking at the index of the template relative to its siblings. This breaks if there are multiple templates at the same level within the same container.

The workaround is to wrap each template.

For example, replace:

<div id=book class=dna-template>
   <p>Title:  <span>~~title~~</span></p>
</div>

with:

<div class=books>
   <div id=book class=dna-template>
      <p>Title:  <span>~~title~~</span></p>
   </div>
</div>

Wrapping templates has as two advantages:
1) Performance, because dna.js does not have to calculate position within the container
2) Semantics, because multiple clones (plural) are closely related and should be in a group (singular)

Nonetheless, this bug needs to be fixed. The fix has been tested and will be released shortly. The fix involves making the location calculation of unwrapped templates smarter to keep track of templates further up in the DOM and adjust automatically as they are cloned.

from dna-engine.

dpilafian avatar dpilafian commented on June 22, 2024

The original test.txt running with the old dna.js v1.3.7:
https://jsfiddle.net/bwrbch25/7

...and with the new dna.js v1.3.8:
https://jsfiddle.net/bwrbch25/8

from dna-engine.

dpilafian avatar dpilafian commented on June 22, 2024

Release v1.3.8

from dna-engine.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.