[whatwg] Proposal for window.DocumentType.prototype.toString

Ian Hickson ian at hixie.ch
Wed Oct 31 19:33:53 PDT 2012

On Wed, 31 Oct 2012, Johan Sundström wrote:
> On Wednesday, October 31, 2012 at 15:02 , Ian Hickson wrote:
> > On Tue, 30 Oct 2012, Johan Sundström wrote:
> > > That said, I would still much enjoy a future where
> > > javascript:alert(document.doctype) would tell you something rich about  
> > > the page that we today need deep knowledge of document.compatMode and/or  
> > > combinations of XMLSerializer and parsers, or deep study of DocumentType  
> > > refdocs to tease out.
> >  
> > Can you elaborate on that?
> Sure – rich as in not "[object DocumentType]", but

Well the toString() isn't what matters, it's what you can get from the 
rest of the attributes on the object. Or are you just saying you wish 
.toString() would expose the concatenated string? That would just be a 
conveniece method. Is it worth the compat risk?

> …on apple.com: <!DOCTYPE html>
> …on roxen.com: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

I don't understand how that is different than document.compatMode, 
really, other than the latter not exposing limited quirks mode. But in 
theory at least, this information is already exposed.

> …on the Firefox default homepage: <!DOCTYPE html [
>   <!ENTITY % htmlDTD
>     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
> [...]

This is for XML, right? In HTML the bit in the square brackets would just 
be dropped. It's not clear that it's worth exposing just for XML...

Anyway, this is the DOM Core spec, so I'll let Anne, Aryeh, and Ms2ger 
give you a proper answer. :-)

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

More information about the whatwg mailing list