Skip to content

Commit

Permalink
Merge pull request #231 from carlosperate/toolbox_nodes
Browse files Browse the repository at this point in the history
Allow XML DOM nodes to be injected as toolbox in IE
  • Loading branch information
NeilFraser committed Jan 8, 2016
2 parents b1b96e4 + bda78da commit dc1f03a
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions core/inject.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,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);
Expand Down

0 comments on commit dc1f03a

Please sign in to comment.