[whatwg/dom] Why is `createProcessingInstruction(…)` allowed in HTML, but `createCDATASection(…)` isn’t? (#798)

They both can’t be expressed in the **HTML** syntax, but one is allowed.

---

Also, the following logs a result that is invalid in both **HTML** and **XML**:

```html
<!DOCTYPE html>
<html data-impo$$ible>
 <head>
  <script defer type="application/javascript">
   var serializer = new XMLSerializer();
   document.addEventListener("DOMContentLoaded", () => {
    document.insertBefore(
     document.createProcessingInstruction('foo', 'bar'),
     document.documentElement,
    );
    console.log(serializer.serializeToString(document));
   });
  </script>
 </head>
</html>
```

Logs:

```xhtml
<!DOCTYPE html>
<?foo bar?>
<html xmlns="http://www.w3.org/1999/xhtml" data-impo$$ible=""><head>
  <script defer="defer" type="application/javascript">
   var serializer = new XMLSerializer();
   document.addEventListener("DOMContentLoaded", () =&gt; {
    document.insertBefore(
     document.createProcessingInstruction('foo', 'bar'),
     document.documentElement,
    );
    console.log(serializer.serializeToString(document));
   });
  </script>
 </head>
<body></body></html>
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/798

Received on Wednesday, 4 December 2019 11:56:10 UTC