Fix node build and add node tests (#2736)

* Fix node build and add node tests
This commit is contained in:
Sam El-Husseini
2019-07-30 11:13:52 -07:00
committed by GitHub
parent 8ef540a8dc
commit 5ce8c68833
12 changed files with 188 additions and 71 deletions

View File

@@ -51,6 +51,18 @@ Blockly.utils.dom.HTML_NS = 'http://www.w3.org/1999/xhtml';
*/
Blockly.utils.dom.XLINK_NS = 'http://www.w3.org/1999/xlink';
/**
* Node type constants.
* https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType
* @enum {number}
*/
Blockly.utils.dom.Node = {
ELEMENT_NODE: 1,
TEXT_NODE: 3,
COMMENT_NODE: 8,
DOCUMENT_POSITION_CONTAINED_BY: 16
};
/**
* Helper method for creating SVG elements.
* @param {string} name Element's tag name.
@@ -171,7 +183,7 @@ Blockly.utils.dom.insertAfter = function(newNode, refNode) {
*/
Blockly.utils.dom.containsNode = function(parent, descendant) {
return !!(parent.compareDocumentPosition(descendant) &
Node.DOCUMENT_POSITION_CONTAINED_BY);
Blockly.utils.dom.Node.DOCUMENT_POSITION_CONTAINED_BY);
};
/**