Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(529)

Side by Side Diff: LayoutTests/svg/custom/use-instanceRoot-modifications.svg

Issue 272523002: Remove SVGElementInstance (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Address esprehns nits Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <?xml version="1.0" standalone="no"?>
2 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1 .1/DTD/svg11.dtd">
3 <svg viewBox="0 0 400 300" version="1.1" xmlns="http://www.w3.org/2000/svg" xmln s:xlink="http://www.w3.org/1999/xlink">
4 <defs>
5 <g id="g">
6 <rect id="rect" stroke-width="5px" fill="red" stroke="navy" width="60" h eight="10"/>
7 <circle id="circle" opacity="0.5" fill="green" cx="30" cy="5" r="10"/>
8 </g>
9 </defs>
10
11 <use x="25" y="25" xlink:href="#g"/>
12 <use x="125" y="25" xlink:href="#g"/>
13
14 <text id="text" x="70" y="70">Test failed.</text>
15
16 <script>
17 function runInstanceRootTest() {
18 var useElement = document.getElementsByTagName("use")[1];
19 if (useElement != useElement.instanceRoot.correspondingUseElement)
20 return;
21
22 var element = useElement.instanceRoot.correspondingElement;
23 if (element != document.getElementById("g"))
24 return;
25
26 // element.firstChild is a #text node! the next sibling gives the rect
27 var rect = element.firstChild.nextSibling;
28 if (rect != document.getElementById("rect"))
29 return;
30
31 // rect.nextSibling is a #text node! the next sibling gives the circle
32 var circle = rect.nextSibling.nextSibling;
33 if (circle != document.getElementById("circle"))
34 return;
35
36 rect.setAttribute("fill", "green");
37 circle.setAttribute("opacity", "0.8");
38
39 document.getElementById("text").firstChild.nodeValue = "Test passed.";
40 }
41 runInstanceRootTest();
42 </script>
43 </svg>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698