Comments (4)
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.
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.
Will be fixed in my PR ^ #42
from ampersand-dom-bindings.
Fixed by e331ea2
from ampersand-dom-bindings.
Related Issues (20)
- Binding with innerHTML didn't fire script tag HOT 7
- Type: class to support some kind of mapping or parse function HOT 5
- Style properties HOT 8
- Borrow features from Backbone.Epoxy
- "falsy" values for attribute bindings act as true for certain attributes HOT 2
- Custom binding types HOT 5
- class binding should support an array of classes HOT 1
- new binding type: switchAttribute HOT 3
- Visibility binding types
- Changing a property bound to a checked property of a checkbox within an event handler can break.
- Add yes/no support to booleanAttribute HOT 1
- Should use amp-result HOT 2
- Update input value on blur
- pass binding context through to custom binding functions HOT 2
- Attribute `indeterminate` is not correctly toggled HOT 3
- class attribute via DOM binding to append itself to existing classes and not overwrite all HOT 1
- Only apply bindings if element is not currently focused
- Binding to a derived property does not update the DOM when the derived value changes HOT 11
- Make bindings extensible HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ampersand-dom-bindings.