You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After upgrading from 0.7.1 to 1.0.0 my tests (that include a Drop instance) are failing. I investigated a little bit and it fails in the getComputedStyle method.
Current implementation (1.0.1):
function getScrollParent(el) {
var _getComputedStyle = getComputedStyle(el);
var position = _getComputedStyle.position;
if (position === 'fixed') {
return el;
}
var parent = el;
while (parent = parent.parentNode) {
var style = undefined;
try {
style = getComputedStyle(parent);
} catch (err) {}
if (typeof style === 'undefined') {
return parent;
}
var overflow = style.overflow;
var overflowX = style.overflowX;
var overflowY = style.overflowY;
if (/(auto|scroll)/.test(overflow + overflowY + overflowX)) {
if (position !== 'absolute' || ['relative', 'absolute', 'fixed'].indexOf(style.position) >= 0) {
return parent;
}
}
}
return document.body;
}
The 1.0.1 version fails on the line if (typeof style === 'undefined') {. It used to check for if (style == null) { which will both check for null and undefined. And apparently when it checks the body in PhantomJS it returns null for the body element.
The text was updated successfully, but these errors were encountered:
I investigated a bit more: that last line isn't entirely correct, it doesn't return null for the <body> element, but it doesn't find any overflow styles there either, thus it traverses up to (by heart) HtmlElement and even further to HtmlDocument or something similar. In the end it will return null nonetheless and therefore will eventually fail on var overflow = style.overflow;
I suggest making it a bit more bullet proof and checking for if (style == null) again.
Thanks for catching that issue. I see no harm in checking for null. Just for reference though, do you have the stack trace of that error? I was under the impression that getComputedStyle returns undefined and not null when no styles are found.
After upgrading from
0.7.1
to1.0.0
my tests (that include a Drop instance) are failing. I investigated a little bit and it fails in thegetComputedStyle
method.Current implementation (1.0.1):
Previous implementation (0.7.1):
The
1.0.1
version fails on the lineif (typeof style === 'undefined') {
. It used to check forif (style == null) {
which will both check fornull
andundefined
. And apparently when it checks the body in PhantomJS it returnsnull
for thebody
element.The text was updated successfully, but these errors were encountered: