Basically that’s the question, how is one supposed to construct a Document object from a string of HTML dynamically in javascript?
Basically that’s the question, how is one supposed to construct a Document object from
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There are two methods defined in specifications,
createDocumentfrom DOM Core Level 2 andcreateHTMLDocumentfrom HTML5. The former creates an XML document (including XHTML), the latter creates a HTML document. Both reside, as functions, on theDOMImplementationinterface.In reality, these methods are rather young and only implemented in recent browser releases. According to http://quirksmode.org and MDN, the following browsers support
createHTMLDocument:Interestingly enough, you can (kind of) create a HTML document in older versions of Internet Explorer, using
ActiveXObject:The resulting object will be a new document, which can be manipulated just like any other document.