From bda78da155dcae667cba6ec52998f295df99a108 Mon Sep 17 00:00:00 2001 From: carlosperate Date: Tue, 5 Jan 2016 00:56:57 +0000 Subject: [PATCH] Allow nodes input to toolbox injection in IE --- core/inject.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/core/inject.js b/core/inject.js index fc2467511b..4420fbb159 100644 --- a/core/inject.js +++ b/core/inject.js @@ -76,12 +76,16 @@ Blockly.inject = function(container, opt_options) { */ Blockly.parseToolboxTree_ = function(tree) { if (tree) { - if (typeof tree != 'string' && typeof XSLTProcessor == 'undefined') { - // In this case the tree will not have been properly built by the - // browser. The HTML will be contained in the element, but it will - // not have the proper DOM structure since the browser doesn't support - // XSLTProcessor (XML -> HTML). This is the case in IE 9+. - tree = tree.outerHTML; + if (typeof tree != 'string') { + if (typeof XSLTProcessor == 'undefined' && tree.outerHTML) { + // In this case the tree will not have been properly built by the + // browser. The HTML will be contained in the element, but it will + // not have the proper DOM structure since the browser doesn't support + // XSLTProcessor (XML -> HTML). This is the case in IE 9+. + tree = tree.outerHTML; + } else if (!(tree instanceof Element)) { + tree = null; + } } if (typeof tree == 'string') { tree = Blockly.Xml.textToDom(tree);