Skip to content

Commit

Permalink
Merge pull request shipshapecode#227 from Shade-/fix-198
Browse files Browse the repository at this point in the history
Added node check to prevent wrong positioning on dynamic content
  • Loading branch information
TrevorBurnham authored Nov 28, 2016
2 parents 5e45012 + ea6f01a commit 7c11c48
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dist/js/tether.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ var getOrigin = function getOrigin() {
// are equivilant or not. We place an element at the top left of the page that will
// get the same jitter, so we can cancel the two out.
var node = zeroElement;
if (!node) {
if (!node || !document.body.contains(node)) {
node = document.createElement('div');
node.setAttribute('data-tether-id', uniqueId());
extend(node.style, {
Expand Down
2 changes: 1 addition & 1 deletion src/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const getOrigin = () => {
// are equivilant or not. We place an element at the top left of the page that will
// get the same jitter, so we can cancel the two out.
let node = zeroElement;
if (!node) {
if (!node || !document.body.contains(node)) {
node = document.createElement('div');
node.setAttribute('data-tether-id', uniqueId());
extend(node.style, {
Expand Down

0 comments on commit 7c11c48

Please sign in to comment.