Changeset 347 for Dev/branches/rest-dojo-ui/client/rft/content.js
- Timestamp:
- 06/24/12 16:25:01 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/branches/rest-dojo-ui/client/rft/content.js
r340 r347 95 95 } 96 96 97 function getFirstNode(html) { 98 var nodeOrFragment = domConstruct.toDom(html); 99 if (nodeOrFragment instanceof Element) { 100 return nodeOrFragment; 101 } 102 if (nodeOrFragment instanceof DocumentFragment) { 103 console.warn("Fragment found, will only use first Element"); 104 for (i in nodeOrFragment.childNodes) { 105 var node = nodeOrFragment.childNodes[i]; 106 if (node instanceof Element) { 107 return node; 108 } 109 } 110 } 111 return domConstruct.toDom('<div>No Element found in template.</div>'); 112 } 113 97 114 function mixinArgs(node) { 98 115 var props = {}; … … 118 135 // initialize page or create error message 119 136 .then(function(html){ 120 var rootNode = domConstruct.toDom(html);137 var rootNode = getFirstNode(html); 121 138 mixinArgs(rootNode); 122 139 contentPane.set('content',rootNode);
Note: See TracChangeset
for help on using the changeset viewer.