-
Notifications
You must be signed in to change notification settings - Fork 309
Closed
Description
Hi,
I can see that we are replying to window and document variables, that won't be great for some edge cases.
For example on this instance:
https://github.com/facebook/fbjs/blob/master/src/__forks__/Style.js#L51
var Style = {
/**
* Gets the style property for the supplied node. This will return either the
* computed style, if available, or the declared style.
*
* @param {DOMNode} node
* @param {string} name Style property name.
* @return {?string} Style property value.
*/
get: getStyleProperty,
/**
* Determines the nearest ancestor of a node that is scrollable.
*
* NOTE: This can be expensive if used repeatedly or on a node nested deeply.
*
* @param {?DOMNode} node Node from which to start searching.
* @return {?DOMWindow|DOMElement} Scroll parent of the supplied node.
*/
getScrollParent: function(node) {
if (!node) {
return null;
}
while (node && node !== document.body) {
if (_isNodeScrollable(node, 'overflow') ||
_isNodeScrollable(node, 'overflowY') ||
_isNodeScrollable(node, 'overflowX')) {
return node;
}
node = node.parentNode;
}
return window;
},
};then Style.getScrollParent won't work on the following example:
var iframeEl = document.getElementById('some_iframe');
var scrollParentEl = Style.getScrollParent(iframeEl.contentWindow.document.getElementById('some_element'));Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels