Inez Korczynski
383e4e324a
Added static function es.DocumentNode.traverseUpstream
2011-11-18 05:18:48 +00:00
Trevor Parscal
c3521b00fd
Fixed the last of the rendering to much bugs - now things are rendered when needed only
2011-11-17 19:05:06 +00:00
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
3ec0976f5d
Made leaf nodes listen for updates from their content views and emit updates themselves in response.
2011-11-16 00:24:46 +00:00
Trevor Parscal
cc8e1d02fc
Changed nodes to selectedNodes for clarity
2011-11-16 00:01:35 +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
c484afe87a
Fix IE-specific test breakages. Two tests were broken because Array.prototype.indexOf() was used, another one because Array.prototype.splice() is broken in IE:
...
>>[1,2,3].slice(0).length
3
>>[1,2,3].slice(0, undefined).length
0
2011-11-15 16:21:45 +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
96a8598ec5
Added scope function to transaction processing so inserting </p></li><li><p> works
...
Fixed off-by-one in splicing dom nodes into view branches
2011-11-14 21:54:53 +00:00
Trevor Parscal
dcbc801f0f
Don't render deleted nodes
2011-11-14 20:04:46 +00:00
Trevor Parscal
e93d050d6f
Only re-render nodes that were inserted
2011-11-14 20:00:40 +00:00
Trevor Parscal
71c3f7d1a7
Fixed documentation for inheritance
2011-11-14 19:50:28 +00:00
Trevor Parscal
872d2bdb9d
Fixed onAfterSplice in es.DocumentViewBranchNode to update the DOM correctly
...
Fixed issue where events were being listened to from this instead of this.model
Added rendering calls after structural changes
2011-11-14 19:50:04 +00:00
Trevor Parscal
521a0644ff
Added extra condition to prevent undefined object errors
2011-11-14 19:48:25 +00:00
Trevor Parscal
fabaff5fc1
Fixed order of operations and added missing attach operation to splicing nodes in a model branch
2011-11-14 19:47:44 +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
f3eab4dec2
Fix JS error when getElementType() is called on a document node
2011-11-10 15:13:57 +00:00
Roan Kattouw
94b30ed0cc
Fix doc comment
2011-11-10 14:00:46 +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
Inez Korczynski
4c8746d661
Add CSS class 'es-viewBranchNode-firstChild' to all first childs of ViewBranchNode
2011-11-07 22:38:01 +00:00
Inez Korczynski
bcaa5c2945
Add CSS class 'es-ViewBranchNode-firstChild' to all first childs of ViewBranchNode
2011-11-07 22:29:28 +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
fbacdfc98a
Reorganized a few methods to reduce duplication, improved documentation
2011-11-04 17:07:34 +00:00
Trevor Parscal
ff0ac9754c
Removed unused file
2011-11-04 16:41:34 +00:00
Trevor Parscal
b636d9a52b
Refactored some of the tree sync code to be reusable
2011-11-03 23:19:36 +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
Inez Korczynski
5f533f0a1d
Implementation of selecting elements with mouse and fix for drawSelection method in DocumentViewBranchNode (it was off by one)
2011-11-03 20:27:57 +00:00
Trevor Parscal
91f0cd2d6b
Renamed expandContentData to getExpandedContentData
2011-11-03 20:01:39 +00:00
Trevor Parscal
cf5be16248
Cleaned up some unused files, added type to es.DocumentModelNode objects for serialization purposes, and added getPlainObject to es.DocumentModelNode which also uses the newly migrated es.DocumentModel.expandContentData
2011-11-03 19:01:55 +00:00
Gabriel Wicke
0d30a5528e
First combination of WikiDom serializers with existing parser in
...
tests/parser/parserTests.js.
* Removed var from es in es.js to allow node.js to access it as global. Only
alternative solution appears to be a node-specific 'exports' construct:
http://nodejs.org/docs/v0.3.1/api/modules.html
* Added es.Document.js and es.Document.Serializer.js in es/bases. Not sure if
this is the desired location.
* Changed es.extend to es.extendClass in the serializers
* Modified the first parser test to include the WikiDom modules and call the
new HTML serializer
2011-11-03 13:55:48 +00:00
Inez Korczynski
6763fe1542
Minor comments cleanup
2011-11-02 22:55:02 +00:00
Inez Korczynski
4a1167117b
Make drawSelection in ContentView works without parameter range being passed and the same for DocumentNode. Define getElementLength and getContentLength as methods in DocumentViewNode.
2011-11-02 22:53:14 +00:00
Trevor Parscal
c70a23fc8d
Fixed incorrect class name
2011-11-02 22:42:30 +00:00