<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
 <head>
  <title>DOM CSS: Dynamically adding style</title>
  <script type="text/javascript">
    function doTest1() {
      var element = document.createElementNS('http://www.w3.org/1999/xhtml', 'link');
      element.setAttribute('href', 'data:text/css,p { color: white; background: green; }');
      element.setAttribute('rel', 'stylesheet');
      document.getElementsByTagNameNS('http://www.w3.org/1999/xhtml', 'head')[0].appendChild(element);
    }
  </script>
  <style type="text/css">
    p { color: red; background: yellow; }
  </style>
 </head>
 <body onload="doTest1()">
  <p>This should be green.</p>
 </body>
</html>
