| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>CSSOM: cssText round-trip with `all: initial`</title> | |
| <link rel="author" title="Peng Zhou" href="mailto:zhoupeng.1996@bytedance.com"> | |
| <link rel="help" href="https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-csstext"> | |
| <link rel="help" href="https://drafts.csswg.org/cssom/#css-declaration-blocks"> | |
| <link rel="match" href="all-initial-csstext-ref.html"> | |
| <style> | |
| .test { | |
| all: initial; | |
| display: block; | |
| border: 1px solid #ccc; | |
| padding: 10px; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <div class="test">First Element</div> | |
| <br/> | |
| <div class="test-clone">Clone element</div> | |
| <script> | |
| const styleSheet = document.styleSheets[0]; | |
| const cssText = styleSheet.cssRules[0].style.cssText; | |
| styleSheet.insertRule('.test-clone { ' + cssText + ' }', 1); | |
| </script> | |
| </body> | |
| </html> |