Comparing version 0.8.9 to 0.8.10
## [Unreleased] | ||
## [0.8.10] - 2017-03-20 | ||
- Made DOM utilities work in nested browsing contexts. | ||
## [0.8.9] - 2017-01-31 | ||
@@ -4,0 +9,0 @@ |
@@ -22,11 +22,15 @@ 'use strict'; | ||
* yet defined. | ||
* | ||
* @param {?DOMDocument} doc Defaults to current document. | ||
* @return {?DOMElement} | ||
*/ | ||
function getActiveElement() /*?DOMElement*/{ | ||
if (typeof document === 'undefined') { | ||
function getActiveElement(doc) /*?DOMElement*/{ | ||
doc = doc || document; | ||
if (typeof doc === 'undefined') { | ||
return null; | ||
} | ||
try { | ||
return document.activeElement || document.body; | ||
return doc.activeElement || doc.body; | ||
} catch (e) { | ||
return document.body; | ||
return doc.body; | ||
} | ||
@@ -33,0 +37,0 @@ } |
@@ -23,3 +23,3 @@ 'use strict'; | ||
function getElementRect(elem) { | ||
var docElem = document.documentElement; | ||
var docElem = elem.ownerDocument.documentElement; | ||
@@ -26,0 +26,0 @@ // FF 2, Safari 3 and Opera 9.5- do not support getBoundingClientRect(). |
@@ -30,4 +30,4 @@ /** | ||
function getScrollPosition(scrollable) { | ||
var documentScrollElement = getDocumentScrollElement(); | ||
if (scrollable === window) { | ||
var documentScrollElement = getDocumentScrollElement(scrollable.ownerDocument || scrollable.document); | ||
if (scrollable.Window && scrollable instanceof scrollable.Window) { | ||
scrollable = documentScrollElement; | ||
@@ -37,3 +37,3 @@ } | ||
var viewport = scrollable === documentScrollElement ? document.documentElement : scrollable; | ||
var viewport = scrollable === documentScrollElement ? scrollable.ownerDocument.documentElement : scrollable; | ||
@@ -40,0 +40,0 @@ var xMax = scrollable.scrollWidth - viewport.clientWidth; |
@@ -26,6 +26,6 @@ /** | ||
function getUnboundedScrollPosition(scrollable) { | ||
if (scrollable === window) { | ||
if (scrollable.Window && scrollable instanceof scrollable.Window) { | ||
return { | ||
x: window.pageXOffset || document.documentElement.scrollLeft, | ||
y: window.pageYOffset || document.documentElement.scrollTop | ||
x: scrollable.pageXOffset || scrollable.document.documentElement.scrollLeft, | ||
y: scrollable.pageYOffset || scrollable.document.documentElement.scrollTop | ||
}; | ||
@@ -32,0 +32,0 @@ } |
@@ -19,5 +19,7 @@ 'use strict'; | ||
function isNode(object) { | ||
return !!(object && (typeof Node === 'function' ? object instanceof Node : typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string')); | ||
var doc = object ? object.ownerDocument || object : document; | ||
var defaultView = doc.defaultView || window; | ||
return !!(object && (typeof defaultView.Node === 'function' ? object instanceof defaultView.Node : typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string')); | ||
} | ||
module.exports = isNode; |
@@ -52,3 +52,4 @@ 'use strict'; | ||
} | ||
while (node && node !== document.body) { | ||
var ownerDocument = node.ownerDocument; | ||
while (node && node !== ownerDocument.body) { | ||
if (_isNodeScrollable(node, 'overflow') || _isNodeScrollable(node, 'overflowY') || _isNodeScrollable(node, 'overflowX')) { | ||
@@ -59,3 +60,3 @@ return node; | ||
} | ||
return window; | ||
return ownerDocument.defaultView || ownerDocument.parentWindow; | ||
} | ||
@@ -62,0 +63,0 @@ |
{ | ||
"name": "fbjs", | ||
"version": "0.8.9", | ||
"version": "0.8.10", | ||
"description": "A collection of utility libraries used by other Facebook JS projects", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 53 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
382298
5395
54
60