Up to what level of abstraction does the <!DOCTYPE>
declaration (and content-type) of a document remain relevant?
For example, if I'm working with XHTML but want to use an element which is not available in XHTML - an easy example being an iframe - would it be bad practice to programatically add the element with JavaScript? Or do I either have to not use the iframe or not use XHTML?
A validator will still validate the document - since it doesn't execute the JS - but is there something theoretically wrong with modifying the DOM so it is no longer consistent with the <!DOCTYPE>
(and returned content-type), or is the <!DOCTYPE>
only relevant to the markup when it is in textual form?
Addendum
To be more specific, my question isn't about how the <!DOCTYPE>
will affect JavaScript or how JavaScript will execute, but how it should affect a developers choices with respect to adding and removing and modifying elements programatically.
My example is if a client both wants XHTML compliance and WYSIWYG editors, what do you do with the iframe which often comes with WYSIWYG editors? Should you remove it from the markup, only to document.appendChild()
it in the JS? Or do you tell your client they have to choose between the two - iframe or XHTML?