Where does the DTD go?
February 22, 2008 11:08 AM Subscribe
For the web developers in the house: when viewing the generated code for a web page, the Document Type Definition is missing. Where does it go?
I'm developing a web application for browsing network device information (on routers, switches, wireless APs, etc.). In debugging a jQuery problem in IE7, I was looking at the app's generated code, the source code after JavaScript has built the page and Ajax has populated it with data from a JSON object. So, long story short: in the generated code of this app and then in every other site I visited (in IE, Firefox, Safari), the Document Type Definition was missing--just gone (inspect the HTML for MeFi with Firebug and you'll see what I mean).
Where does the DTD go? and why? Any ideas?
I'm developing a web application for browsing network device information (on routers, switches, wireless APs, etc.). In debugging a jQuery problem in IE7, I was looking at the app's generated code, the source code after JavaScript has built the page and Ajax has populated it with data from a JSON object. So, long story short: in the generated code of this app and then in every other site I visited (in IE, Firefox, Safari), the Document Type Definition was missing--just gone (inspect the HTML for MeFi with Firebug and you'll see what I mean).
Where does the DTD go? and why? Any ideas?
Wait, you're saying that when you view-source on ANY page on the internet using ANY browser, the doctype is missing? I see malevolent's point about it being outside the DOM tree, but you say this happens on IE and safari as well, yes? so presumably in those browsers you are not looking at the DOM, you are looking at the page source?
If you view-source (Ctrl-U) on this page, what is the first line of HTML that you see?
posted by misterbrandt at 1:14 PM on February 22, 2008
If you view-source (Ctrl-U) on this page, what is the first line of HTML that you see?
posted by misterbrandt at 1:14 PM on February 22, 2008
Oh sorry, you're just talking about generated source. Yeah, I think malevolent has it -- it is an instruction to the browser as to which parsing engine to use, but it is not itself an element, and can't be manipulated or accessed via the DOM.
posted by misterbrandt at 1:57 PM on February 22, 2008
posted by misterbrandt at 1:57 PM on February 22, 2008
View source shows the DTD to me just fine on any website that's well-behaved enough to HAVE a DTD. DOM interpreters, like Firebug and the slew of others, don't have it -- because as malevolent and misterbrandt say, it's not part of the DOM.
posted by delfuego at 1:59 PM on February 22, 2008
posted by delfuego at 1:59 PM on February 22, 2008
Response by poster: Great, thanks for the input. This answers it for me.
posted by josephtate at 4:58 PM on February 22, 2008
posted by josephtate at 4:58 PM on February 22, 2008
This thread is closed to new comments.
posted by malevolent at 11:33 AM on February 22, 2008