Roan Kattouw
f8fd9fd840
Add an extra offset parameter to selectNodes() and use it in the recursion, so the results of recursive calls don't need to have their globalRanges translated
2011-11-17 18:00:16 +00:00
Roan Kattouw
be994da373
Make selectNodes() also descend (recurse) into child nodes when only the start or only the end is in the middle of a child node. Without this, it was stuff like ranges with only openings and no closings.
2011-11-17 15:01:47 +00:00
Roan Kattouw
2c21250c70
Make selectNodes() not return an empty array when encountering a zero-length selection in a structural location (we don't do this for zero-length selections in content locations either, and the empty array is breaking an assumption I was making in my prepareRemoval rewrite)
2011-11-17 14:50:38 +00:00
Trevor Parscal
5f4a2b2141
* Added support for inserting content at a structural offset
...
* Broke rebuildNodes into 2 parts so insert can use just buildNodes when inserting whole nodes
* Added getIndexFromOffset to es.DocumentModelBranchNode objects, which returns an index of a child node from an offset
2011-11-16 20:39:48 +00:00
Roan Kattouw
27ddd1263f
In selectNodes(), also set globalRange for fully-covered nodes. There is no sane value for range in this case, but there sure is a sane value for globalRange so we might as well return it. I also use this in my prepareRemoval() fixes in my next commit
2011-11-16 19:02:23 +00:00
Roan Kattouw
9060cd6161
Fix stupid mistake that broke traverseLeafNodes() in IE
2011-11-16 12:51:31 +00:00
Trevor Parscal
4f1f6699ee
Tweaks to make jshint happy
2011-11-15 18:42:34 +00:00
Trevor Parscal
79ef19da42
Fixed documentation and use of es.arrayIndexOf to match the actual API of $.inArray (value, array, fromIndex). Renamed function to inArray to reduce confusion about how the function works.
2011-11-15 18:17:26 +00:00
Trevor Parscal
a4e3b3922d
Using jQuery.inArray implementation of indexOf instead of our own
...
Fixed a wrong class name bug
2011-11-15 17:54:52 +00:00
Roan Kattouw
eff198ff1d
Move .indexOf() from es.DocumentModelBranchNode to es.DocumentBranchNode and use it in .traverseLeafNodes()
2011-11-15 16:24:33 +00:00
Roan Kattouw
ec8e92029a
Followup r103161: make reverse work
2011-11-15 13:23:04 +00:00
Roan Kattouw
f7ef40fb7a
Rewrite traverseLeafNodes() with an iterative traversal, and add support for from. Support for reverse is not implemented yet.
2011-11-15 12:55:31 +00:00
Roan Kattouw
fee2d48b2b
Add very basic implementation of traverseNodes(), with tests. This doesn't respect the from parameter (so tests 3-6 fail); I will rewrite it from recursive to iterative so it can support that.
2011-11-15 11:12:06 +00:00
Trevor Parscal
a7c1524fe0
Added empty method to es.DocumentBranchNode called traverseLeafNodes
2011-11-15 01:31:46 +00:00
Trevor Parscal
2494c40297
Moved transaction processing code to new class, es.TransactionProcessor
2011-11-14 23:04:36 +00:00
Trevor Parscal
713a80596d
Added es.DocumentLeafNode, which like es.DocumentBranchNode is a mixin-like class (we may want to switch to using a more natural composition mechanism than es.extendClass in the future) - now es.DocumentNode also has an abstract method called hasChildren which returns a boolean and can indicate if a node is a leaf or a branch.
2011-11-10 19:26:02 +00:00
Roan Kattouw
14b56c1202
Fix selectNodes(), can't recurse into leaf nodes because they aren't DocumentBranchNodes and don't have the selectNodes function. The pattern of certain functions just not existing for leaf nodes is starting to annoy me, I'll discuss this with Trevor.
2011-11-10 13:51:01 +00:00
Roan Kattouw
aa7a6e2605
Add globalRange property to the output of selectNodes(), which translates the range property to be relative to the root rather than to the node. Update tests for this, and fix the test case numbering for selectNodes
2011-11-10 13:15:55 +00:00
Roan Kattouw
69d2fe7dfe
Fix selectNodes() behavior for structural offsets (i.e. offsets between two openings/closings). There are no test cases for this yet but I'll write some after Trevor finishes his massive test data change
2011-11-09 21:15:01 +00:00
Roan Kattouw
124a36b942
Add a metric ton of (mostly generated) selectNodes tests, and change selectNodes a little bit to make them pass
2011-11-04 20:27:23 +00:00
Trevor Parscal
fcb3644f35
Reorganized a few methods to reduce duplication, improved documentation
2011-11-04 17:07:44 +00:00
Trevor Parscal
f327ebf39f
Line breaks
2011-11-03 22:03:28 +00:00
Trevor Parscal
8058b454a5
Fixed some documentation
2011-11-03 21:52:06 +00:00
Trevor Parscal
764f2b0e65
Reorganized model nodes into branches and leafs
2011-11-03 21:48:40 +00:00