dom-node-tostring

Get the string form of a DOM node

Usage no npm install needed!

<script type="module">
  import domNodeTostring from 'https://cdn.skypack.dev/dom-node-tostring';
</script>

README

dom-node-tostring

Install

npm install --save dom-node-tostring

Usage

const nodeToString = require('dom-node-tostring');
console.log(nodeToString(document.querySelector('body')));

Or with es2015 modules:

import nodeToString from 'dom-node-tostring';
console.log(nodeToString(document.querySelector('body')));

About

Sometimes I want to get what would be equivalent to outerHTML without using outerHTML. This module solves that problem.