Allow to pass an array index to removeAttr in Observe and Observe.List #325

Merged
merged 1 commit into from Mar 23, 2013

Conversation

Projects
None yet
2 participants
@schovi
Contributor

schovi commented Mar 20, 2013

With this you can pass arrays into removeAttr method

o = new can.Observe({array:[{nested: "yes we can!"}]})
o.bind('change', fuction(ev, prop, type, newVal, oldVal) {console.log(arguments)})
o.removeAttr('array.0.nested') // -> "yes we can!"
// Event trigger arguments [{event object}, "array.0.nested", "remove", undefined, "yes we can!"]
o.attr('array.0.nested') // -> undefined

Fiddle with current state where this will throw an error http://jsfiddle.net/2a8TW/

@daffl

This comment has been minimized.

Show comment
Hide comment
@daffl

daffl Mar 22, 2013

Contributor

👍 Thanks! That looks good. I think this can go into 1.1.5 for Sunday.

Contributor

daffl commented Mar 22, 2013

👍 Thanks! That looks good. I think this can go into 1.1.5 for Sunday.

daffl added a commit that referenced this pull request Mar 23, 2013

Merge pull request #325 from schovi/observe-removeattr-array
Allow to pass an array index to removeAttr in Observe and Observe.List

@daffl daffl merged commit 1cb63c9 into canjs:master Mar 23, 2013

1 check passed

default The Travis build passed
Details

@schovi schovi deleted the schovi:observe-removeattr-array branch Mar 26, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment