Esanders has uploaded a new change for review.
https://gerrit.wikimedia.org/r/173346
Change subject: Move hasSignificantWhitespace and handlesOwnChildren abstracts
to ve.Node.
......................................................................
Move hasSignificantWhitespace and handlesOwnChildren abstracts to ve.Node.
Change-Id: I10ffa5097d7df60a37ab7725422d64c6d99f3e34
---
M src/ce/ve.ce.Node.js
M src/dm/ve.dm.Node.js
M src/ve.Node.js
3 files changed, 40 insertions(+), 20 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor
refs/changes/46/173346/1
diff --git a/src/ce/ve.ce.Node.js b/src/ce/ve.ce.Node.js
index 2e38835..a08bbb4 100644
--- a/src/ce/ve.ce.Node.js
+++ b/src/ce/ve.ce.Node.js
@@ -128,17 +128,6 @@
};
/**
- * Check if the node handles its own children
- *
- * This method passes through to the model.
- *
- * @returns {boolean} Node handles its own children
- */
-ve.ce.Node.prototype.handlesOwnChildren = function () {
- return this.model.handlesOwnChildren();
-};
-
-/**
* @inheritdoc ve.Node
*
* If this is set to true it should implement:
@@ -153,6 +142,20 @@
/**
* @inheritdoc ve.Node
*/
+ve.dm.Node.prototype.hasSignificantWhitespace = function () {
+ return this.model.hasSignificantWhitespace();
+};
+
+/**
+ * @inheritdoc ve.Node
+ */
+ve.ce.Node.prototype.handlesOwnChildren = function () {
+ return this.model.handlesOwnChildren();
+};
+
+/**
+ * @inheritdoc ve.Node
+ */
ve.ce.Node.prototype.getLength = function () {
return this.model.getLength();
};
diff --git a/src/dm/ve.dm.Node.js b/src/dm/ve.dm.Node.js
index dcd28a9..ddd839d 100644
--- a/src/dm/ve.dm.Node.js
+++ b/src/dm/ve.dm.Node.js
@@ -378,21 +378,14 @@
ve.dm.Node.prototype.canHaveSlugAfter = ve.dm.Node.prototype.canHaveSlugBefore;
/**
- * Check if the node has significant whitespace.
- *
- * Can only be true if canContainContent is also true.
- *
- * @method
- * @returns {boolean} Node has significant whitespace
+ * @inheritdoc ve.Node
*/
ve.dm.Node.prototype.hasSignificantWhitespace = function () {
return this.constructor.static.hasSignificantWhitespace;
};
/**
- * Check if the node handles its own children
- *
- * @returns {boolean} Node handles its own children
+ * @inheritdoc ve.Node
*/
ve.dm.Node.prototype.handlesOwnChildren = function () {
return this.constructor.static.handlesOwnChildren;
diff --git a/src/ve.Node.js b/src/ve.Node.js
index abd4310..e77aa35 100644
--- a/src/ve.Node.js
+++ b/src/ve.Node.js
@@ -162,6 +162,30 @@
};
/**
+ * Check if the node has significant whitespace.
+ *
+ * Can only be true if canContainContent is also true.
+ *
+ * @method
+ * @abstract
+ * @returns {boolean} Node has significant whitespace
+ */
+ve.Node.prototype.hasSignificantWhitespace = function () {
+ throw new Error( 've.Node.hasSignificantWhitespace must be overridden
in subclass' );
+};
+
+/**
+ * Check if the node handles its own children
+ *
+ * @method
+ * @abstract
+ * @returns {boolean} Node handles its own children
+ */
+ve.Node.prototype.handlesOwnChildren = function () {
+ throw new Error( 've.Node.handlesOwnChildren must be overridden in
subclass' );
+};
+
+/**
* Get the length of the node.
*
* @method
--
To view, visit https://gerrit.wikimedia.org/r/173346
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I10ffa5097d7df60a37ab7725422d64c6d99f3e34
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits