Re: getComputedStyle - Why window member function?
"Axel Dahmen" <[email protected]> Fri, 11 Feb 2011 11:37:53 +0100
| Newsgroups | gmane.comp.mozilla.devel.dom |
|---|---|
| Message-ID | <[email protected]> |
I see. So each window will find only the styles of the elements of that particular window then. I understand. > Why would it be? How is that better than the Window? Because styles are not a window's property but a document's property. It wouldn't come up my mind to search in the cupboard for motor oil, either. That's why. But I understand that it's been a design accident. However, it wouldn't harm to also add this interface to the Document class, too. Best regards, Axel ---------------- "Boris Zbarsky" schrieb im Newsbeitrag news:[email protected]... On 2/9/11 5:45 PM, Axel Dahmen wrote: > At "http://www.howtocreate.co.uk/tutorials/javascript/domcss" I just > read that the getComputedStyle() DOM Level 2 Style member function of > the ViewCSS interface is a member of the window object. > > I wonder how it works on a frames based webpage. Each frame has its own Window object, for what it's worth. > Why isn't this interface being applied to the Document object? Why would it be? How is that better than the Window? In any case, the DOM spec doesn't define which object the defaultView is for a Document. It also doesn't define anything about Window objects at all. The fact that the defaultView is the Window is a historical accident, but at this point it's a de-facto standard, probably going to be documented de-jure in HTML5. -Boris _______________________________________________ dev-tech-dom mailing list [email protected] https://lists.mozilla.org/listinfo/dev-tech-dom