/**
* Clones a template element for use as a shadow tree.
*/
protected XBLOMShadowTreeElement cloneTemplate
(XBLOMTemplateElement template) {
XBLOMShadowTreeElement clone =
(XBLOMShadowTreeElement)
template.getOwnerDocument().createElementNS(XBL_NAMESPACE_URI,
XBL_SHADOW_TREE_TAG);
NamedNodeMap attrs = template.getAttributes();
for (int i = 0; i < attrs.getLength(); i++) {
Attr attr = (Attr) attrs.item(i);
if (attr instanceof AbstractAttrNS) {
clone.setAttributeNodeNS(attr);
} else {
clone.setAttributeNode(attr);
}
}
for (Node n = template.getFirstChild();
n != null;
n = n.getNextSibling()) {
clone.appendChild(n.cloneNode(true));
}
return clone;
}