Catrope
379bc8da3c
selectNodes() fixes:
...
* Initialize startOffset to 0 not 1, don't know what I was thinking
* Use currentFrame for nodeRange instead of parentFrame, don't know what
I was thinking there either
* If the returned node has no parent (is the document node), don't
attempt to access parentFrame and don't set index
Change-Id: Iad969a7c29436cdf4151ead7e9d3d8e2a30befb3
2012-05-10 20:20:42 -07:00
Catrope
7eeb6c7cac
Throw an exception when DocumentFragment gets unbalanced input
...
Change-Id: Ie891bd7ea4d9e9b1c84e7a0390f1af39c0e55fd4
2012-05-10 20:20:42 -07:00
Trevor Parscal
1475100a22
Ported isContentOffset, isStructuralOffset, isElementData, containsElementData and getRelativeContentOffset
...
Tests for all but getRelativeContentOffset are done too
Change-Id: Iee953647ec89e13259ae2a402c50c809f93bc655
2012-05-10 17:20:57 -07:00
Christian Williams
081ec31ccd
Merge branch 'dmrewrite' of ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor into dmrewrite
2012-05-10 16:58:47 -07:00
Christian Williams
d1dbb32238
Fixing updateDomWrapper test
...
Change-Id: I93f5ceb96a9212652aa93eeebaf91ad1c5704ae5
2012-05-10 16:58:29 -07:00
Catrope
8834145f9e
Fix nodeSelectionEqual() so it doesn't explode when a and b have unequal lengths
...
Change-Id: Idb84bc1238576c711a201cdbf05f63a7b603a819
2012-05-10 16:42:58 -07:00
Catrope
9b6402801a
Fix the selectNodes() bug that Inez reported
...
Selecting a zero-length range at the start or end of a text node
(e.g. (1,1)) would return the text node's parent instead of the text
node
Change-Id: I7fe089bf66b93185dd3415eff53aa7e04e3ffdb2
2012-05-10 16:42:58 -07:00
Catrope
f79e56b4f1
Document the stack properties used in selectNodes()
...
Change-Id: Ibaf178830a0b7b99a4ab1c0ec09283bd3dd552e0
2012-05-10 16:42:58 -07:00
Catrope
ec449d168a
Fix startOffset computation in selectNodes()
...
* Needs to be initialized to 1, not 0
* Needs to be stored *after* left is incremented to account for an
opening
Change-Id: I7978ae241578a8a17120e494684e6e93626a8529
2012-05-10 16:42:58 -07:00
Catrope
38a9b8b301
Fix typo in selectNodes()
...
Change-Id: I320728bafa289290c4c2a91fee736a8afb17be80
2012-05-10 16:42:58 -07:00
Christian Williams
6e7c02a126
Merge branch 'dmrewrite' of ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor into dmrewrite
2012-05-10 16:29:37 -07:00
Christian Williams
07b4534a4c
Basic test for HTMLConverter
...
Change-Id: Ie3fa3e036b92052305288c64edca8f404afded72
2012-05-10 16:28:45 -07:00
Catrope
13b79d309c
Add 'index' and 'nodeRange' to selectNodes() output
...
Change-Id: I38712545b713cc24663ebec3fe3e5c8741b4fad7
2012-05-10 15:03:23 -07:00
Catrope
e137659722
Fix spelling of 'equivalent'
...
Change-Id: I0a444059c187ab5608aeca85a85c147ad1d69de6
2012-05-10 15:02:11 -07:00
Trevor Parscal
7168b4e041
Removed duplicate node rules from tests
...
These methods are wrappers for the model methods where the rules are actually being applied
Change-Id: I08be359010fa9fa81cd3a8aa5152083f92dc0b9c
2012-05-10 14:57:52 -07:00
Trevor Parscal
8d07a4e08c
Fixed test so it doesn't break when nodes add classes in their constructors
...
Change-Id: Ib2f7bcedcf61a9b98da0e3e889f309f271483064
2012-05-10 14:55:13 -07:00
Trevor Parscal
d4363c04f4
Don't set classes on non-wrapped elements
...
* Text nodes do not have a wrapper to set classes on
* Use CSS class names that are equivalent to JS class names, swapping . with -
Change-Id: I49c877dd5c9b5dd2a9afad3137f12b14883043a1
2012-05-10 14:54:33 -07:00
Inez Korczynski
3848e77c33
Basic support for Alien node in HTMLDom -> LinMod converter
...
Change-Id: Ie9b08027c58694022a7b01609d25d720bfb35873
2012-05-09 23:04:57 -07:00
Inez Korczynski
156e15c66b
Added missing reference to ve.Document.js
...
Change-Id: I893442dcb1518c4c05e29fe29aece82ac04fe5c8
2012-05-09 22:51:46 -07:00
Inez Korczynski
41a7451ea2
Store reference to view node (ve.ce.Node) in jQuery data of it's wrapper
...
Change-Id: I84920b20346b4ef5e1203d834bf4c3fb9657ae69
2012-05-09 22:43:46 -07:00
Inez Korczynski
1a4e488b06
Merge branch 'dmrewrite' of ssh://review/mediawiki/extensions/VisualEditor into dmrewrite
2012-05-09 22:40:51 -07:00
Inez Korczynski
ee39e837b8
Get Alien node (leaftnode) working - it reads its content from attribute
...
'html'
Change-Id: Idd84da9af61369277df18fee577032de765b1205
2012-05-09 22:36:25 -07:00
Trevor Parscal
1798a478e7
Massive refactor of node trees, generalizing lots of previously dm only stuff
...
Change-Id: I9dbb7094f86338ea2e725ad29f66e9e4ca2b52ed
2012-05-09 21:11:09 -07:00
Christian Williams
0848eaca04
Merge branch 'dmrewrite' of ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor into dmrewrite
2012-05-09 18:36:05 -07:00
Christian Williams
3d289365bc
Images and tables working with HTMLConverter
...
Change-Id: I2e45eeddf031d00b006498f9b2fb4840a2f6df44
2012-05-09 18:35:05 -07:00
Trevor Parscal
b4478216be
Added tests for document synchronizer
...
Change-Id: If114e3fc962598f7ea8f7f8ec8975a3b0d2d83e6
2012-05-09 18:31:09 -07:00
Trevor Parscal
44b311920e
Cleanup/refactor/documentation work for ve.dm.DocumentSynchronizer
...
Change-Id: I5f70460e0d4496c91d92b83025fdf9ae1d9dece6
2012-05-09 17:14:15 -07:00
Trevor Parscal
2747ff05c5
Added basic test for ve.dm.DocumentSychronizer
...
Change-Id: Ieea96aaf0477b4d9ba7e59f5cf6f20f4b867a419
2012-05-09 17:13:55 -07:00
Rob Moen
d417c571a4
* Ported getAnnotationsFromOffset into DocumentFragment
...
* Wrote unit test for getAnnotationsFromOffset
Change-Id: Ie88b15ac6c16838b2d2bf9a2d83ca2952f5df817
2012-05-09 16:31:56 -07:00
Trevor Parscal
89a2b1bc40
Fixed naming in test moved from ve.dm.DocumentFragment to ve.dm.Document
...
Change-Id: I6843e452b0222632d1d244568bd75f3b229b4954
2012-05-09 15:30:18 -07:00
Trevor Parscal
c017d7421c
Removed use of expected in conjunction with ve.dm.example.*Equal methods
...
Change-Id: I48108f3fac7dda32344e105b7c52483cd2a84ef9
2012-05-09 15:28:06 -07:00
Trevor Parscal
a0178fd3bb
Cleanup and renaming
...
Change-Id: Ie0b742029f95e1475d58bb38b790bae3110259b0
2012-05-09 15:27:18 -07:00
Catrope
17f4dc220a
Don't use data.length in selectNodes()
...
I was using data.length to check if the range was out of bounds, but
this is a problem when using selectNodes() inside of tree sync code
(which happens when performing rebuilds). While tree sync is in
progress, the model tree and the linear model don't match, so we
shouldn't be looking at the linear model for information about the model
tree. Instead, get the length of the DocumentNode and use that.
`
Change-Id: I11a378544ce1281a89cdcd4363c5cb1bf56f3434
2012-05-08 18:31:51 -07:00
Catrope
00950f3a67
Add rebuild action to DocumentSynchronizer
...
Change-Id: I379ceef3829026c4b4157e59243b7663b6c7ab2f
2012-05-08 18:31:51 -07:00
Catrope
94697a3241
Emit an 'update' event in addition to an 'annotation' event
...
Change-Id: Idab673bce4fa4b10816d753020adae40598c8b7a
2012-05-08 18:31:51 -07:00
Catrope
09631f1466
Make TransactionProcessor actually use DocumentSynchronizer
...
Change-Id: If0ac69026fa34430d811de5f7ca0748d9b1e01cc
2012-05-08 18:31:51 -07:00
Catrope
22c88f77c3
Add a 'siblings' mode to selectNodes(), and add tests for it
...
Change-Id: Ib3fd3ee5aba7aab7c26193a2a9c48612f624862a
2012-05-08 18:31:50 -07:00
Trevor Parscal
d061b62a72
Added some documentation to ve.dm.DocumentSynchronizer constructor
...
Change-Id: Ib24f0101e60b34af292d46d3ea866859a89a18f5
2012-05-07 19:43:34 -07:00
Trevor Parscal
d43ee569ac
Cleanup of HTMLConverter
...
Change-Id: I145bfbbb8b759ea33eef291b53daf935e97ac341
2012-05-07 19:43:03 -07:00
Trevor Parscal
123c64cbd5
Added more tests for selectNodes
...
Change-Id: Ibd9672fb9b6ce682905d20f9346fada6fb47b380
2012-05-07 19:03:59 -07:00
Catrope
4d9299b808
Fix bugs in selectNodes(), tests pass now
...
Also fix one instance of bad expected data in a selectNodes test
Change-Id: Ie226b237cf537143bce2f6b1e531b9067b140cb4
2012-05-07 17:03:42 -07:00
Catrope
32c65cdaa8
Change 'leaf' to 'leaves' and document it
...
Change-Id: I09d5995d3d9bf82670802f0efe849f40be2a18a3
2012-05-07 17:03:42 -07:00
Catrope
770775eec0
Fix rebuildNodes tests, were messing up ve.dm.example
...
Fixed by operating on a copy of the data instead
Change-Id: Ia2607d94f07b8d43e8c98ae8a94c34df90081508
2012-05-07 17:03:42 -07:00
Trevor Parscal
4bae026190
Added additional test to rebuildNodes, now testing rebuilding after a change
...
Change-Id: I669457389bf742c100dec5205b972f6d1e14ef44
2012-05-07 16:25:39 -07:00
Trevor Parscal
811110d7c6
Simplified selectNode tests
...
Change-Id: I878fd430b24661fc11c953b3303e395cdd617006
2012-05-07 16:18:24 -07:00
Trevor Parscal
88a05b5606
Added another falling selectNodes test
...
Change-Id: I1f18b0af956c98a5facaf12a88fd94ca76e50a65
2012-05-07 16:05:40 -07:00
Trevor Parscal
e1f8fef228
Changed selectNodes test to desired behavior (which fails atm)
...
Change-Id: I79eb5caaa3e2193e2309d37dc1d0ca67c2602836
2012-05-07 15:50:11 -07:00
Trevor Parscal
f4fcf9663e
Added documentation and tests for ve.dm.Document.selectNodes
...
Also:
* Broke node lookup method out into ve.dm.example.lookupNode
* Added ve.dm.example.nodeSelectionEqual
Change-Id: I437cdd3f3154d10782f03f78df6d5c457ecfc845
2012-05-07 15:15:21 -07:00
Inez Korczynski
82ef058cb7
Add two more cats to demo/example article
...
Change-Id: I25757965ffdfceed2c85c9d76ce58af3d23716f2
2012-05-07 14:30:05 -07:00
Catrope
ad5ee8f822
First implementation of selectNodes()
...
Currently only implements mode=='leaves', i.e. traverse all leaf nodes.
Seems to work from casual testing, but is missing unit tests. See also
other TODO comments in this commit
Change-Id: I41292c21c627a18af7985e8ef9e23c7b14252b21
2012-05-07 13:57:58 -07:00