Tree Change History
3.18.1
- No changes.
3.18.0
- No changes.
3.17.2
- No changes.
3.17.1
- No changes.
3.17.0
- Fixed: Moving a node to another tree fails when that node has children. (#1689: @rgrove)
3.16.0
- No changes.
3.15.0
- No changes.
3.14.1
- No changes.
3.14.0
- No changes.
3.13.0
- No changes.
3.12.0
- Fixed:
Tree.Sortable
failed to reindex a node’s children after sorting them, which could result inTree#indexOf()
andTree.Node#index()
returning incorrect indices. [Ryan Grove]
3.11.0
-
Added
Tree.Node#depth()
, which returns the depth of the node, starting at 0 for the root node. [Ryan Grove] -
Added
Tree.Sortable#sort()
, which sorts the children of every node in a sortable tree. [Ryan Grove] -
Tree#emptyNode()
now removes nodes without triggering a node map reindex for each node, which makes it significantly faster when emptying a node with lots of children. [Ryan Grove] -
When inserting a node that already exists in the same parent (which results in that node being removed and then re-inserted),
Tree#insertNode()
now adjusts the insertion index to ensure that the node is re-inserted at the correct position after being removed, even if that position has shifted as a result of the removal. [Ryan Grove] -
The
remove
event is now fired when a node is removed and re-inserted as the result of aTree#appendNode()
,Tree#insertNode()
, orTree#prependNode()
call. Previously, the node was removed silently with no event.The
src
property of theremove
event facade in this case will be set to “add”. Filter on this source if you want to ignore these events. [Ryan Grove] -
The
Tree#createNode()
,Tree#insertNode()
, andTree#traverseNode()
methods now throw or log informative error messages when given a destroyed node instead of failing cryptically (or succeeding when they shouldn’t). [Ryan Grove] -
The
Tree.Node#isRoot()
method now returnsfalse
on destroyed nodes instead of causing an exception. [Ryan Grove] -
The
Tree.Sortable#sortNode()
andTree.Sortable.Node#sort()
methods now accept adeep
option. If set totrue
, the entire hierarchy will be sorted (children, children’s children, etc.). [Ryan Grove] -
Tree.Sortable: Sort comparator functions are now executed in their original context. When the sort comparator lives on the tree, its
this
object will be the tree instance. When it lives on a node, itsthis
object will be the node. When specified as an anonymous function in an options object, itsthis
object will be the global object. [Ryan Grove]
3.10.3
- No changes.
3.10.2
- No changes.
3.10.1
- No changes.
3.10.0
-
Added
Tree#findNode()
andTree.Node#find()
methods, which pass the specified node and each of its descendants to a callback function and returns the first node for which the callback returns a truthy value. [Ryan Grove] -
Added
Tree#traverseNode()
andTree.Node#traverse()
methods, which pass the specified node and each of its descendants to a callback function in depth-first order. [Ryan Grove] -
Added a
Tree.Sortable
extension, which can be mixed into any Tree class to provide customizable sorting logic for nodes. [Ryan Grove] -
Fixed: The number returned by
Tree#size()
didn’t include the root node. [Ryan Grove]
3.9.1
- Added a
src
option to all methods that trigger events. This value is passed along to the event facade of the resulting event, and can be used to distinguish between changes caused by different sources (such as user-initiated changes vs. programmatic changes). [Ryan Grove]
3.9.0
- Initial release. [Ryan Grove]