All,
I'm in the process of cleaning up the code in c.g.g.dom that depends upon
$doc (which it shouldn't, as this code is all intended to work with multiple
documents) and upon DocumentRootImpl (which it *really* shouldn't, for the
same reason). This is forcing me to answer the question "just what the heck
*is* this document root element, anyway?". The best characterization I can
come up with is something like:

  "the element, which is either document.body or document.documentElement,
which you need to
  use if you want to work with document scrolling, client size (i.e. the
window's client area), and the
  magic 'body offset' on some browsers".

It's not a standard DOM element or property, but it's definitely needed. I
originally created the method Document.getDocumentRootElement(), but this
just feels kind of wrong. The only alternative approach I can think of would
be to explicitly define methods such as Document.scrollLeft/Top,
Document.clientLeft/Top/Width/Height, and Document.getBodyOffsetLeft/Top()
(the last of which already exists). However, this still leaves the element's
CSS properties -- so, for example, if you want to turn off document
scrolling, you have to set the "document root" element's overflow style. To
do this using the same pattern, I would have to add something ugly like
Document.enableScrolling() (like the existing Window.enableScrolling()), or
perhaps Document.getStyle() (the former of which feels really weirdly
special-cased, and the latter of which feels wrong, because the Document
object doesn't technically have a style).

One other completely simplifying possibility would be to *only* provide
document.getDocumentElement(), and simply redefine it to return the <body>
element in quirks-mode. Does anyone know if the "real"
document.documentElement serves any purpose in quirks mode? If not, I'm
inclined to simply redefine it, which would make all these problems go away.

@Fred: I seem to recall discussing some of the ins and outs of this with you
in the past. Any opinions?

Thanks,
joel.

--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---

Reply via email to