Skip to content

stevenvachon/assign-dom-doctype

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

About

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

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published