| ZVON > References > Zvon Example Repository |
| Intro / Search / ZVON |
| Example repository: index | categories | search |
| Elements | Attributes |
|---|---|
| a | xlink:href | |
| desc | id | |
| g | id | style | |
| path | d | style | |
| rect | fill | height | id | style | width | x | y | |
| script | type | |
| svg | height | id | onload | width | |
| text | id | style | x | y | |
| title | id | |
function domTest(evt) {
// Get Document
var target = evt.target;
var doc = target.ownerDocument;
//
// Test attribute modification
//
var attributeErrorRect = doc.getElementById('attributeErrorRect');
attributeErrorRect.setAttribute('width', '0')
attributeErrorRect.setAttribute('height', '0');
//
// Test removing element from DOM tree
//
var elementErrorText = doc.getElementById('elementErrorText');
var parent = elementErrorText.getParentNode();
parent.removeChild(elementErrorText);
//
// Test adding element to the DOM tree
//
var newText = doc.createElement('text');
newText.setAttribute('x', '50');
newText.setAttribute('y', '200');
var textContent = doc.createTextNode('DOM API is supported');
newText.appendChild(textContent);
parent.appendChild(newText);
}
</script>