| 1 |
<svg id="svg-root" width="100%" height="100%" viewBox="0 0 480 360" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> |
| 2 |
<!--======================================================================--> |
| 3 |
<!--= Copyright 2008 World Wide Web Consortium, (Massachusetts =--> |
| 4 |
<!--= Institute of Technology, European Research Consortium for =--> |
| 5 |
<!--= Informatics and Mathematics (ERCIM), Keio University). =--> |
| 6 |
<!--= All Rights Reserved. =--> |
| 7 |
<!--= See http://www.w3.org/Consortium/Legal/. =--> |
| 8 |
<!--======================================================================--> |
| 9 |
<d:SVGTestCase xmlns:d="http://www.w3.org/2000/02/svg/testsuite/description/" template-version="1.4" reviewer="CM" author="Microsoft" status="reviewed" version="$Revision: 1.3 $" testname="$RCSfile: struct-dom-17-f.svg,v $"> |
| 10 |
<d:testDescription xmlns="http://www.w3.org/1999/xhtml" href="http://dev.w3.org/SVG/profiles/1.1F2/publish/struct.html#InterfaceSVGSVGElement"> |
| 11 |
<p> |
| 12 |
Tests that the 'getElementById' method for the 'SVGSVGElement' interface is scoped. |
| 13 |
</p> |
| 14 |
<p> |
| 15 |
Two subtrees of 'svg' elements are used, each with 'rect' elements as children. A reference to the first 'svg' element is obtained via the |
| 16 |
'document' element's 'getElementById' method. This reference is used to verify the presence of 'getElementId'. Next, 'getElementById' on |
| 17 |
the 'SVGSVGElement' reference is used to locate its child element. Then, 'getElementById' attempts to get an element in a neighboring subtree. |
| 18 |
Finally, an element at the sibling level is attempted to be accessed via 'getElementById'. |
| 19 |
</p> |
| 20 |
</d:testDescription> |
| 21 |
<d:operatorScript xmlns="http://www.w3.org/1999/xhtml"> |
| 22 |
</d:operatorScript> |
| 23 |
<d:passCriteria xmlns="http://www.w3.org/1999/xhtml"> |
| 24 |
<p> |
| 25 |
The test is passed if there is no red visible on the page. |
| 26 |
</p> |
| 27 |
</d:passCriteria> |
| 28 |
</d:SVGTestCase> |
| 29 |
<title id="test-title">$RCSfile: struct-dom-17-f.svg,v $</title> |
| 30 |
<defs> |
| 31 |
<font-face |
| 32 |
font-family="SVGFreeSansASCII" |
| 33 |
unicode-range="U+0-7F"> |
| 34 |
<font-face-src> |
| 35 |
<font-face-uri xlink:href="../resources/SVGFreeSans.svg#ascii"/> |
| 36 |
</font-face-src> |
| 37 |
</font-face> |
| 38 |
</defs> |
| 39 |
<g id="test-body-content" font-family="SVGFreeSansASCII,sans-serif" font-size="18"> |
| 40 |
<svg id="svgTree1"> |
| 41 |
<rect id="subElem1" /> |
| 42 |
</svg> |
| 43 |
<svg id="svgTree2"> |
| 44 |
<rect id="subElem2" /> |
| 45 |
</svg> |
| 46 |
<rect id="siblingElem1" /> |
| 47 |
<g transform="translate(320,350)" font-size="50"> |
| 48 |
<text id="failText" fill="red">FAIL</text> |
| 49 |
<text id="passText" fill="green" display="none">PASS</text> |
| 50 |
</g> |
| 51 |
<script type="text/javascript"><![CDATA[ |
| 52 |
try |
| 53 |
{ |
| 54 |
var passedCount = 0; |
| 55 |
var svgTree1 = document.getElementById("svgTree1"); |
| 56 |
|
| 57 |
// Test support for "getElementById" on svgTree1 |
| 58 |
var subElem1 = svgTree1.getElementById("subElem1"); |
| 59 |
if (null != subElem1) |
| 60 |
{ |
| 61 |
passedCount++; |
| 62 |
} |
| 63 |
|
| 64 |
if ("subElem1" == subElem1.id) |
| 65 |
{ |
| 66 |
passedCount++; |
| 67 |
} |
| 68 |
|
| 69 |
// Test that "getElementById" on svgTree1 can't access children in other subtrees |
| 70 |
if (null == svgTree1.getElementById("subElem2")) |
| 71 |
{ |
| 72 |
passedCount++; |
| 73 |
} |
| 74 |
|
| 75 |
// Test that "getElementById" on svgTree1 can't access elements that are not its children |
| 76 |
if (null == svgTree1.getElementById("siblingElem1")) |
| 77 |
{ |
| 78 |
passedCount++; |
| 79 |
} |
| 80 |
|
| 81 |
if (4 == passedCount) |
| 82 |
{ |
| 83 |
document.getElementById("failText").setAttribute("display", "none"); |
| 84 |
document.getElementById("passText").setAttribute("display", "inline"); |
| 85 |
} |
| 86 |
} |
| 87 |
catch(ex) |
| 88 |
{ |
| 89 |
// alert('ERROR: ' + ex.message); |
| 90 |
}]]> |
| 91 |
</script> |
| 92 |
</g> |
| 93 |
<g font-family="SVGFreeSansASCII,sans-serif" font-size="32"> |
| 94 |
<text id="revision" x="10" y="340" stroke="none" |
| 95 |
fill="black">$Revision: 1.3 $</text> |
| 96 |
</g> |
| 97 |
<rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000"/> |
| 98 |
<!-- comment out this watermark once the test is approved --> |
| 99 |
<g id="draft-watermark"> |
| 100 |
<rect x="1" y="1" width="478" height="20" fill="red" stroke="black" stroke-width="1"/> |
| 101 |
<text font-family="SVGFreeSansASCII,sans-serif" font-weight="bold" font-size="20" x="240" |
| 102 |
text-anchor="middle" y="18" stroke-width="0.5" stroke="black" fill="white">DRAFT</text> |
| 103 |
</g> |
| 104 |
</svg> |