mirror of
https://github.com/google/blockly.git
synced 2026-01-08 09:30:06 +01:00
Replacing node.parentNode.removeChild(node)
...with Blockly.utils.removeNode(..), which includes a null/undefined check on parentNode before continuing.
This commit is contained in:
@@ -114,6 +114,16 @@ Blockly.utils.hasClass = function(element, className) {
|
||||
return (' ' + classes + ' ').indexOf(' ' + className + ' ') != -1;
|
||||
};
|
||||
|
||||
/**
|
||||
* Removes a node from its parent. No-op if not attached to a parent.
|
||||
* @param {Node} node The node to remove.
|
||||
* @return {Node} The node removed if removed; else, null.
|
||||
*/
|
||||
// Copied from Closure goog.dom.removeNode
|
||||
Blockly.utils.removeNode = function(node) {
|
||||
return node && node.parentNode ? node.parentNode.removeChild(node) : null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Don't do anything for this event, just halt propagation.
|
||||
* @param {!Event} e An event.
|
||||
|
||||
Reference in New Issue
Block a user