mirror of
https://github.com/google/blockly.git
synced 2026-01-08 17:40:09 +01:00
Merge pull request #231 from carlosperate/toolbox_nodes
Allow XML DOM nodes to be injected as toolbox in IE
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user