Setting the doctype with DOM methods

Subscribe to Setting the doctype with DOM methods 3 posts, 3 voices

 
padra User

Hello,

Is there some way to add a doctype with DOM methods to a document?

Thanks,
Padra

 
lazyttrick Scriptwright

try something like this:
1. get 'html' node
2. try to get previousSibling, avoid useless #text nodes with node.tagName... if there's no tagName just skip it to previous again

dunno if it works, but...

 
Descriptor Scriptwright

document.doctype : read-only - DOM level 2 doesn't support editing the document type declaration.
docType cannot be altered in any way, including through the use of methods inherited from the Node interface, such as insertNode or removeNode.