Skip to content

Latest commit

 

History

History
57 lines (38 loc) · 1.62 KB

README.md

File metadata and controls

57 lines (38 loc) · 1.62 KB

assign-dom-doctype NPM Version File Size Build Status Coverage Status

Insert, replace or remove a DocumentType node within a Document.

Installation

Node.js >= 10 is required. To install, type this at the command line:

npm install assign-dom-doctype

Importing

ES Module:

import assignDoctype from 'assign-dom-doctype';

CommonJS Module:

const assignDoctype = require('assign-dom-doctype');

Usage

Insert or replace:

const newDoctype = document.implementation.createDocumentType('qualifiedNameStr', 'publicId', 'systemId');

assignDoctype(newDoctype, document);

Remove:

assignDoctype(null, document);

The Document's previous doctype value will be returned.

Compatibility

Depending on your target browsers, you may need polyfills/shims for the following: