Giter VIP home page Giter VIP logo

Comments (4)

pgilad avatar pgilad commented on June 19, 2024

This is definitely an edge case - &-dom looks for a matching value and turns it visible, and then hides all the rest.
What is your purposed solution to this? If we have a match, before hiding the other elements should their value be compared to the matching element and then it should not be hidden?

I'm not sure users are actually expecting this behavior.
@AmpersandJS/core-team ?

See the failing test case I made: https://github.com/AmpersandJS/ampersand-dom-bindings/blob/failing-switch/test/index.js#L892-L928

from ampersand-dom-bindings.

latentflip avatar latentflip commented on June 19, 2024

This is definitely an edge case - &-dom looks for a matching value and turns it visible, and then hides all the rest.

I don't think that's quite correct. As per these lines we're just iterating through the cases, showing and hiding as we go. I'm guessing from @bryanspears example and looking at the code, that if the value is 'one' then #one will not be visible, because it'll be hidden when we test 'two'. But if value is 'two' #one will in fact be visible because of the order we iterate the object.

I don't think I'd be opposed to a PR which fixed this behaviour.

from ampersand-dom-bindings.

pgilad avatar pgilad commented on June 19, 2024

Will be fixed in my PR ^ #42

from ampersand-dom-bindings.

pgilad avatar pgilad commented on June 19, 2024

Fixed by e331ea2

from ampersand-dom-bindings.

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.