Tchanders has uploaded a new change for review.
https://gerrit.wikimedia.org/r/314724
Change subject: Allow ommission of range from ve.dm.Document cloneFromRange
......................................................................
Allow ommission of range from ve.dm.Document cloneFromRange
Clone the whole document if range is omitted.
Change-Id: I8dba1e3dfb24a32e0add6caaa9d3c78993c34f0a
---
M src/dm/ve.dm.Document.js
1 file changed, 2 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor
refs/changes/24/314724/1
diff --git a/src/dm/ve.dm.Document.js b/src/dm/ve.dm.Document.js
index 67b343a..901f951 100644
--- a/src/dm/ve.dm.Document.js
+++ b/src/dm/ve.dm.Document.js
@@ -596,13 +596,13 @@
* Clone a sub-document from a range in this document. The new document's
elements, store and internal list
* will be clones of the ones in this document.
*
- * @param {ve.Range} range Range of data to clone
+ * @param {ve.Range} [range] Range of data to clone, clones the whole document
if ommitted.
* @return {ve.dm.Document} New document
*/
ve.dm.Document.prototype.cloneFromRange = function ( range ) {
var listRange = this.getInternalList().getListNode().getOuterRange(),
data = ve.copy( this.getFullData( range, true ) );
- if ( range.start > listRange.start || range.end < listRange.end ) {
+ if ( range && ( range.start > listRange.start || range.end <
listRange.end ) ) {
// The range does not include the entire internal list, so add
it
data = data.concat( this.getFullData( listRange ) );
}
--
To view, visit https://gerrit.wikimedia.org/r/314724
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8dba1e3dfb24a32e0add6caaa9d3c78993c34f0a
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Tchanders <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits