ZVON > References > Zvon Example Repository
Example repository: index | categories | search

All > SVG > DOM > dom-core-BE-01


File: dom-core-BE-01
Author: Vincent Hardy
Origin: W3C SVG conformance suite

Rendered imageSVG source
ElementsAttributes
axlink:href |
descid |
gid | style |
pathd | style |
rectfill | height | id | style | width | x | y |
scripttype |
svgheight | id | onload | width |
textid | style | x | y |
titleid |

Source

<svg id="svg-root" width="450" height="450" onload="domTest(evt)" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" >
     <title id="test-title">dom-core-BE-01</title>
     <desc id="test-desc">Checks if DOM ECMA Script binding is supported</desc>
     <g id="test-body-content">
          <script type="text\ecmascript">
		
    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>
          <rect id="attributeErrorRect" width="450" height="450" style="fill:red;" fill="red"/>
          <text id="elementErrorText" x="50" y="200" style="font-family:Verdana;font-size:20;fill:black;"> Removing DOM Elements is not supported </text>
     </g>
     <g id="test-legend" style="fill:black;font-family:Helvetica;font-size:10;">
          <rect x="10" y="390" width="275" height="50" style="fill:none;stroke:#000000;"/>
          <path style="fill:none;stroke:#000000;" d="M10 405 h275 M205 405 v35 M10 426 h195 M205 422 h80"/>
          <text x="25" y="401">Scalable Vector Graphics (SVG) Conformance Suite</text>
          <a xlink:href="copyright-documents-19990405.html">
               <text x="12" y="437" style="fill:blue;"> Copyright 2000 W3C. All Rights Reserved. </text>
          </a>
          <text style="font-size:12;" x="35" y="420">dom-core-BE-01</text>
          <text style="font-size:10;" x="210" y="417">$Revision: 1.1 $</text>
          <text style="font-size:10;" x="210" y="435">Release 2.0</text>
          <rect id="test-frame" x="1" y="1" width="448" height="448" style="fill:none;stroke:#000000;"/>
     </g>
</svg>



Sponsored links: Domain Names, VoIP Internettelefonie, DSL, SDSL, ADSL, UNLIMITED Web Hosting by HostDepartment, conference call service, answering service