export default function doctypeToString(doctype) { if (doctype === null) { return '' } // Checking with instanceof DocumentType might be neater, but how to get a // reference to DocumentType without assuming it to be available globally? // To play nice with custom DOM implementations, we resort to duck-typing. if (!doctype || doctype.nodeType !== doctype.DOCUMENT_TYPE_NODE || typeof doctype.name !== 'string' || typeof doctype.publicId !== 'string' || typeof doctype.systemId !== 'string' ) { throw new TypeError('Expected a DocumentType') } const doctypeString = `` return doctypeString }