var region = _stylePreviewRegions.get(lastValue);
var rect = region.getBoundingClientRect();
- var top = rect.top + window.scrollY;
+ var top = rect.top + (window.scrollY || window.pageYOffset);
DomUtil.setStyles(_stylePreviewRegionMarker, {
height: (region.clientHeight + 20) + 'px',
if (align === 'top') {
var bodyHeight = document.body.clientHeight;
bottom = (bodyHeight - refOffsets.top) + verticalOffset;
- if (bodyHeight - (bottom + elDimensions.height) < window.scrollY) {
+ if (bodyHeight - (bottom + elDimensions.height) < (window.scrollY || window.pageYOffset)) {
result = false;
}
}
else {
top = refOffsets.top + refDimensions.height + verticalOffset;
- if (top + elDimensions.height - window.scrollY > windowHeight) {
+ if (top + elDimensions.height - (window.scrollY || window.pageYOffset) > windowHeight) {
result = false;
}
}
// get the offsets of the bounding box of current text selection
var rect = data.selection.getRangeAt(0).getBoundingClientRect();
var offsets = {
- top: Math.round(rect.bottom) + window.scrollY,
+ top: Math.round(rect.bottom) + (window.scrollY || window.pageYOffset),
left: Math.round(rect.left) + document.body.scrollLeft
};
if (this._lineHeight === null) {
- this._lineHeight = Math.round(rect.bottom - rect.top - window.scrollY);
+ this._lineHeight = Math.round(rect.bottom - rect.top - (window.scrollY || window.pageYOffset));
}
// restore caret position
this._selectItem(0);
- if (offset.top + this._dropdownMenu.offsetHeight + 10 > window.innerHeight + window.scrollY) {
+ if (offset.top + this._dropdownMenu.offsetHeight + 10 > window.innerHeight + (window.scrollY || window.pageYOffset)) {
this._dropdownMenu.style.setProperty('top', offset.top - this._dropdownMenu.offsetHeight - 2 * this._lineHeight + 7 + 'px', '');
}
},