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

All > SVG > DOM > dom-featureString-BE-03


File: dom-featureString-BE-03
Author: Vincent Hardy
Origin: W3C SVG conformance suite

Rendered imageSVG source
ElementsAttributes
axlink:href |
descid |
gid | style |
pathd | style |
rectheight | id | style | width | x | y |
scripttype |
svgheight | id | onload | width |
textstyle | 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-featureString-BE-03</title>
     <desc id="test-desc">Checks if DOM/ECMA Script binding is supported. Checks support for the hasFeature method on the DOMImplementation. </desc>
     <g id="test-body-content">
          <script type="text\ecmascript">
		
    var featureStrings = new Array();
		var length = 0;
		featureStrings[length++] = "xml";
		featureStrings[length++] = "stylesheets";
		featureStrings[length++] = "views";
		featureStrings[length++] = "css2";
		featureStrings[length++] = "events";
		featureStrings[length++] = "uievents	";
		featureStrings[length++] = "mouseevents";
		featureStrings[length++] = "mutationevents";
		featureStrings[length++] = "traversal";
		featureStrings[length++] = "org.w3c.svg";
		featureStrings[length++] = "org.w3c.svg.lang";
		featureStrings[length++] = "org.w3c.svg.dynamic";
		featureStrings[length++] = "org.w3c.svg.static";
		featureStrings[length++] = "org.w3c.dom.svg";
		featureStrings[length++] = "org.w3c.svg";
		featureStrings[length++] = "org.w3c.dom.svg.static";
		featureStrings[length++] = "org.w3c.dom.svg.animation";
		featureStrings[length++] = "org.w3c.dom.svg.dynamic";
		featureStrings[length++] = "org.w3c.svg.all";
		featureStrings[length++] = "org.w3c.dom.svg.all";
                var svg_ns = "http://www.w3.org/2000/svg";

    function domTest(evt) {
		// Get Document
		var target = evt.target;
		var doc = target.ownerDocument;

    // Get DOMImplementation
	  var domImpl = doc.implementation;

		// 
		// Iterate through the feature strings
		//
		for(var i=0; i<featureStrings.length; i++){
			var supports = domImpl.hasFeature(featureStrings[i], '2.0');
			addTextElement(featureStrings[i], supports, doc, target, (75 + 15*i));
		}
		}

		function addTextElement(label, value, doc, svg, y){
			var newText = doc.createElementNS(svg_ns, 'text');
			newText.setAttribute('x', '10');
			newText.setAttribute('y', y);
			var textValue = label;
			var textContent = doc.createTextNode(textValue);
		  newText.appendChild(textContent);
			svg.appendChild(newText);

			newText = doc.createElement('text');
			newText.setAttribute('x', '180');
			newText.setAttribute('y', y);
			textValue =  value;
			textContent = doc.createTextNode(textValue);
			newText.appendChild(textContent);
			svg.appendChild(newText);
		}
		
	
</script>
     </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-featureString-BE-03</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: Web Design Chicago, VoIP Internettelefonie, DSL, SDSL, ADSL