Giter Site home page Giter Site logo

Comments (5)

patrick-steele-idem avatar patrick-steele-idem commented on August 24, 2024 1

Hey @shannonmoeller, the recommended solution is to assign an id attribute with a unique value for each <video> element and morphdom will match the elements up by the assigned ID.

If you don't like assigning an "id" attribute then you can provide your own getNodeKey(el) function:

var morphedNode = morphdom(fromNode, toNode, {
    getNodeKey: function(el) {
        return el.id;
    },
    ...
});

Let me know if that doesn't solve your problem.

from morphdom.

shannonmoeller avatar shannonmoeller commented on August 24, 2024 1

This doesn't fully solve the issue. When an item is removed from the list, the other elements remain, so we're half way there. However, if an element is moved down the list, it's still getting overridden by the new element, even with the same id.

from morphdom.

shannonmoeller avatar shannonmoeller commented on August 24, 2024

I'm thinking this could be used for a quick comparison:

https://developer.mozilla.org/en-US/docs/Web/API/Node/isEqualNode

from morphdom.

shannonmoeller avatar shannonmoeller commented on August 24, 2024

Oh, awesome. I wasn't aware of that. Thanks!

from morphdom.

AutoSponge avatar AutoSponge commented on August 24, 2024

It sounds like range.insertNode (or insertBefore) would do the trick. Instead of morphing, you would need to move the existing node to the new location in the DOM. @patrick-steele-idem does this sound correct?

from morphdom.

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.