diff --git a/core/xml.js b/core/xml.js index c542a0e4c..3006663a1 100644 --- a/core/xml.js +++ b/core/xml.js @@ -252,7 +252,7 @@ Blockly.Xml.cloneShadow_ = function(shadow) { while (node && !node.nextSibling) { textNode = node; node = node.parentNode; - if (textNode.nodeType == Element.TEXT_NODE && + if (textNode.nodeType == Node.TEXT_NODE && textNode.data.trim() == '' && node.firstChild != textNode) { // Prune whitespace after a tag. Blockly.utils.removeNode(textNode); @@ -261,7 +261,7 @@ Blockly.Xml.cloneShadow_ = function(shadow) { if (node) { textNode = node; node = node.nextSibling; - if (textNode.nodeType == Element.TEXT_NODE && + if (textNode.nodeType == Node.TEXT_NODE && textNode.data.trim() == '') { // Prune whitespace before a tag. Blockly.utils.removeNode(textNode); @@ -568,7 +568,7 @@ Blockly.Xml.domToBlock = function(xmlBlock, workspace) { */ Blockly.Xml.domToVariables = function(xmlVariables, workspace) { for (var i = 0, xmlChild; xmlChild = xmlVariables.childNodes[i]; i++) { - if (xmlChild.nodeType != Element.ELEMENT_NODE) { + if (xmlChild.nodeType != Node.ELEMENT_NODE) { continue; // Skip text nodes. } var type = xmlChild.getAttribute('type'); @@ -601,7 +601,7 @@ Blockly.Xml.domToBlockHeadless_ = function(xmlBlock, workspace) { var blockChild = null; for (var i = 0, xmlChild; xmlChild = xmlBlock.childNodes[i]; i++) { - if (xmlChild.nodeType == Element.TEXT_NODE) { + if (xmlChild.nodeType == Node.TEXT_NODE) { // Ignore any text at the level. It's all whitespace anyway. continue; } @@ -611,7 +611,7 @@ Blockly.Xml.domToBlockHeadless_ = function(xmlBlock, workspace) { var childBlockElement = null; var childShadowElement = null; for (var j = 0, grandchild; grandchild = xmlChild.childNodes[j]; j++) { - if (grandchild.nodeType == Element.ELEMENT_NODE) { + if (grandchild.nodeType == Node.ELEMENT_NODE) { if (grandchild.nodeName.toLowerCase() == 'block') { childBlockElement = /** @type {!Element} */ (grandchild); } else if (grandchild.nodeName.toLowerCase() == 'shadow') { diff --git a/externs/browser-externs.js b/externs/browser-externs.js deleted file mode 100644 index 38a84fdd9..000000000 --- a/externs/browser-externs.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * @license - * Visual Blocks Editor - * - * Copyright 2019 Google Inc. - * https://developers.google.com/blockly/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @fileoverview Property definitions in browsers that Closure Compiler is - * unaware of. - * @author fraser@google.com (Neil Fraser) - * - * @externs - */ -'use strict'; - - -Element.ELEMENT_NODE = 1; -Element.TEXT_NODE = 3; diff --git a/tests/compile/compile.sh b/tests/compile/compile.sh index 6352746a3..f60c37cb1 100755 --- a/tests/compile/compile.sh +++ b/tests/compile/compile.sh @@ -82,7 +82,6 @@ COMPILATION_COMMAND="java -jar $COMPILER --js='$BLOCKLY_ROOT/tests/compile/main. --js='$CLOSURE_LIB_ROOT/closure/goog/**.js' \ --js='$CLOSURE_LIB_ROOT/third_party/closure/goog/**.js' \ --generate_exports \ - --externs $BLOCKLY_ROOT/externs/browser-externs.js \ --externs $BLOCKLY_ROOT/externs/svg-externs.js \ --compilation_level ADVANCED_OPTIMIZATIONS \ --dependency_mode=STRICT --entry_point=Main \