OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <!-- | |
3 Copyright 2012 The Polymer Authors. All rights reserved. | |
4 Use of this source code is goverened by a BSD-style | |
5 license that can be found in the LICENSE file. | |
6 --> | |
7 <meta charset="utf-8"> | |
8 <script src="shadowdom.js"></script> | |
9 <style> | |
10 | |
11 .el, | |
12 .sr { | |
13 height: 300px; | |
14 width: 300px; | |
15 } | |
16 | |
17 </style> | |
18 <textarea class="el" placeholder="Element host"></textarea> | |
19 <textarea class="sr" placeholder="Shadow Root"></textarea> | |
20 <button onclick="update()">Update</button> | |
21 | |
22 <div class="test">Real</div> | |
23 | |
24 <script> | |
25 | |
26 var el = document.querySelector('.test'); | |
27 var sr = el.createShadowRoot(); | |
28 | |
29 sr.innerHTML = 'Before <content></content> After'; | |
30 | |
31 function update() { | |
32 el.innerHTML = document.querySelector('.el').value; | |
33 sr.innerHTML = document.querySelector('.sr').value; | |
34 } | |
35 | |
36 document.querySelector('.el').value = el.innerHTML; | |
37 document.querySelector('.sr').value = sr.innerHTML; | |
38 | |
39 </script> | |
OLD | NEW |