Skip to content

Commit 3d57b8d

Browse files
committed
batch getComputedStyle calls
1 parent ff0e6e2 commit 3d57b8d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

scrollparent.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,13 @@
1515
return parents(node.parentNode, ps.concat([node]));
1616
};
1717

18-
var style = function (node, prop) {
19-
return getComputedStyle(node, null).getPropertyValue(prop);
18+
var style = function (css, prop) {
19+
return css.getPropertyValue(prop);
2020
};
2121

2222
var overflow = function (node) {
23-
return style(node, "overflow") + style(node, "overflow-y") + style(node, "overflow-x");
23+
const css = getComputedStyle(node, null);
24+
return style(css, "overflow") + style(css, "overflow-y") + style(css, "overflow-x");
2425
};
2526

2627
var scroll = function (node) {

0 commit comments

Comments
 (0)