Re: [spec-reviews] CSSOM View document.scrollingElement (#51)

@mikesherov 

> what about a boolean property rather than an additional reference to document.documentElement?

It’s not just another reference to a fixed value. `document.scrollingElement` would only be a reference to `document.documentElement` in standards mode and if the browser implements the scrolling element as per the spec. I.e. if WebKit were to implement `document.scrollingElement` before fixing their bug, `document.scrollingElement` would not point to `document.documentElement` even in standards mode.

> […] This would look like:
>
> ```js
> function getScrollingElement() {
>   if (document.documentElement.isScrollingElement) {
>     return document.documentElement;
>   }
>   return /* whatever UA check they use now */;
> }
> ```

No, it would then have to look like:

```js
function getScrollingElement() {
  if (document.documentElement.isScrollingElement) {
    return document.documentElement;
  }
  if (document.body.isScrollingElement) {
    return document.body;
  }
  return /* whatever UA check they use now */;
}
```

---
Reply to this email directly or view it on GitHub:
https://github.com/w3ctag/spec-reviews/issues/51#issuecomment-95726289

Received on Thursday, 23 April 2015 21:34:40 UTC