Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | |
| 2 // for details. All rights reserved. Use of this source code is governed by a | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 #library('ShadowDOMTest'); | |
| 6 | |
| 7 #import('dart:html'); | |
| 8 | |
| 9 // Test that children of a shadow host get distributed properly to the | |
| 10 // insertion points of a shadow subtree. Output should be three boxes, | |
| 11 // ordered blue, red, green down the page. | |
| 12 main() { | |
| 13 var div = new DivElement(); | |
| 14 document.body.elements.add(div); | |
| 15 | |
| 16 // build some DOM elements | |
| 17 var bluebox = _colorBox('blue', 40, 20); | |
| 18 bluebox.classes.add('foo'); | |
| 19 var redbox = _colorBox('red', 30, 30); | |
| 20 var greenbox = _colorBox('green', 60, 10); | |
| 21 | |
| 22 // assemble DOM | |
| 23 var sr = new ShadowRoot(div); | |
|
Siggi Cherem (dart-lang)
2012/06/29 20:20:38
following jacob's comment from the other CL, maybe
samhop
2012/06/29 20:25:12
Done.
| |
| 24 sr.nodes.add(new Element.html('<content select=".foo"></content>')); | |
| 25 sr.nodes.add(redbox); | |
| 26 sr.nodes.add(new Element.tag('content')); | |
| 27 div.nodes.add(bluebox); | |
|
Siggi Cherem (dart-lang)
2012/06/29 20:20:38
maybe add an empty line above this to see the divi
samhop
2012/06/29 20:25:12
Done.
| |
| 28 div.nodes.add(greenbox); | |
| 29 } | |
| 30 | |
| 31 DivElement _colorBox(String color, int width, int height) { | |
| 32 var style = ('background-color:$color; ' | |
| 33 'width:${width}px; height:${height}px;'); | |
| 34 return new Element.html('<div style="$style"></div>'); | |
| 35 } | |
| OLD | NEW |