Skip to content

Array.observe lacks 'move' change type and Array.prototype lacks move(from, to) method #17

Open
@alexanderby

Description

@alexanderby

Since Array.observe may be used to bind some collection model to DOM elements, the move() method and move change type are needed to move the nodes associated with collection items. Currently it is only possible to handle addition, removal and replacement of collection items which leads to possibly unnecessary nodes removal and re-additions.
Some example (works in Chrome): http://jsfiddle.net/alexanderby/fd0mrp8j/

As an example .NET's INotifyCollectionChange has such an action and ObservableCollection implements a Move method.

Also Array.prototype.sort() method should notify of move change type instead of update, as far as moved collection item may be collection itself and it's replacement may cause re-creation off associated DOM.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions