Readme.md 1.0 KiB

1234567891011121314151617181920212223242526272829303132
  1. # document-outerhtml
  2. Like [Element.outerHTML][], but for the whole [Document][].
  3. This means it returns a string containing the `<html>.....</html>` with all the content between, plus the `<!DOCTYPE ....>` declaration (if present), and any comments and stray elements or text nodes.
  4. ## Install
  5. npm install "git+https://code.treora.com/gerben/document-outerhtml#latest"
  6. npm install document-outerhtml@latest
  7. ..or equivalent
  8. ## Usage
  9. import documentOuterHTML from 'document-outerhtml'
  10. const html = documentOuterHTML(document)
  11. ## Licence
  12. [CC0](https://creativecommons.org/publicdomain/zero/1.0/); do whatever you want with this code.
  13. ## See also
  14. - [XMLSerializer.serializeToString][]; does nearly the same thing, except it creates XML.
  15. [Element.outerHTML]: https://developer.mozilla.org/en-US/docs/Web/API/Element/outerHTML
  16. [Document]: https://developer.mozilla.org/en-US/docs/Web/API/Document
  17. [XMLSerializer.serializeToString]: https://developer.mozilla.org/en-US/docs/Web/API/XMLSerializer/serializeToString