scrollingelement
Advanced tools
Comparing version 1.5.0 to 1.5.1
{ | ||
"name": "scrollingelement", | ||
"version": "1.5.0", | ||
"version": "1.5.1", | ||
"description": "A `document.scrollingElement` polyfill.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://mths.be/scrollingelement", |
@@ -22,5 +22,5 @@ # `document.scrollingElement` | ||
* Chrome | ||
* Opera 11.64+ | ||
* Firefox 3.5+ | ||
* Internet Explorer 8+ (but [should work even in older versions](https://github.com/mathiasbynens/document.scrollingElement/issues/4)) | ||
* Opera 11.64+ | ||
* Safari 8+ (but [should work even in Safari 4](https://github.com/mathiasbynens/document.scrollingElement/issues/5)) | ||
@@ -32,12 +32,8 @@ | ||
Thanks to [Simon Pieters](https://simon.html5.org/) ([@zcorpan](https://twitter.com/zcorpan)) for reviewing the code. | ||
## Authors | ||
## Author | ||
This polyfill was written by [Mathias Bynens](https://mathiasbynens.be/) and [Simon Pieters](https://simon.html5.org/), with help from [contributors](https://github.com/mathiasbynens/document.scrollingElement/graphs/contributors). | ||
| [![twitter/mathias](https://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](https://twitter.com/mathias "Follow @mathias on Twitter") | | ||
|---| | ||
| [Mathias Bynens](https://mathiasbynens.be/) | | ||
## License | ||
This project is available under the [MIT](https://mths.be/mit) license. |
@@ -1,3 +0,13 @@ | ||
/*! https://mths.be/scrollingelement v1.5.0 by @diegoperini & @mathias | MIT license */ | ||
/*! https://mths.be/scrollingelement v1.5.1 by @diegoperini & @mathias | MIT license */ | ||
if (!('scrollingElement' in document)) (function() { | ||
function computeStyle(element) { | ||
if (window.getComputedStyle) { | ||
// Support Firefox < 4 which throws on a single parameter. | ||
return getComputedStyle(element, null); | ||
} | ||
// Support Internet Explorer < 9. | ||
return element.currentStyle; | ||
} | ||
function isBodyElement(element) { | ||
@@ -12,2 +22,3 @@ // The `instanceof` check gives the correct result for e.g. `body` in a | ||
} | ||
function getNextBodyElement(frameset) { | ||
@@ -53,2 +64,3 @@ // We use this function to be correct per spec in case `document.body` is | ||
}; | ||
function isRendered(style) { | ||
@@ -58,7 +70,8 @@ return style.display != 'none' && !(style.visibility == 'collapse' && | ||
} | ||
function isScrollable(body) { | ||
// A `body` element is scrollable if `body` and `html` both have | ||
// non-`visible` overflow and are both being rendered. | ||
var bodyStyle = getComputedStyle(body); | ||
var htmlStyle = getComputedStyle(document.documentElement); | ||
var bodyStyle = computeStyle(body); | ||
var htmlStyle = computeStyle(document.documentElement); | ||
return bodyStyle.overflow != 'visible' && htmlStyle.overflow != 'visible' && | ||
@@ -102,3 +115,2 @@ isRendered(bodyStyle) && isRendered(htmlStyle); | ||
} | ||
}()); |
7617
104
38