var element = evt.target; var bar = element.shadowTree; var rect = bar.getElementById("drawing_bar"); // get attributes from custom tag var x = 0, y = 0, width = 0, height = 0; nb_attributes = element.attributes.length for (i = 0; i < nb_attributes;i++) { attribute = element.attributes.item(i) switch(attribute.name) {case "x" : x = attribute.value - 0 ; break; case "y" : y = attribute.value - 0 ; break; case "width" : width = attribute.value - 0 ; break; case "height" : height = attribute.value - 0 ; break; case "onclick" : break; case "onmousedown" : break; case "onmousemove" : break; case "onmouseup" : break; case "onmouseover" : break; case "onmouseout" : break; case "id" : break; case "cursor" : break; default : rect.setAttributeNS(null, attribute.name, attribute.value) } } // calculate d attribute for rect var x_rect = x; var y_rect = y - height; var width_rect = width; var height_rect = height; // apply attributes rect.setAttributeNS(null, "x", x_rect.toString()); rect.setAttributeNS(null, "y", y_rect.toString()); rect.setAttributeNS(null, "width", width_rect.toString()); rect.setAttributeNS(null, "height", height_rect.toString());