Skip to content

Commit

Permalink
Fixed bug PrismJS#1496
Browse files Browse the repository at this point in the history
  • Loading branch information
RunDevelopment committed Jul 24, 2018
1 parent 2a100db commit 8a1ae72
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 17 deletions.
23 changes: 7 additions & 16 deletions plugins/previewers/prism-previewers.js
Original file line number Diff line number Diff line change
Expand Up @@ -473,21 +473,12 @@
* @returns {{top: number, right: number, bottom: number, left: number}}
*/
var getOffset = function (element) {
var left = 0, top = 0, el = element;

if (el.parentNode) {
do {
left += el.offsetLeft;
top += el.offsetTop;
} while ((el = el.offsetParent) && el.nodeType < 9);

el = element;

do {
left -= el.scrollLeft;
top -= el.scrollTop;
} while ((el = el.parentNode) && !/body/i.test(el.nodeName));
}
var bb = element.getBoundingClientRect();
var left = bb.left;
var top = bb.top;
bb = document.documentElement.getBoundingClientRect();
left -= bb.left;
top -= bb.top;

return {
top: top,
Expand Down Expand Up @@ -712,4 +703,4 @@
previewers[previewer].create();
}

}());
}());
Loading

0 comments on commit 8a1ae72

Please sign in to comment.