Skip to content

Commit

Permalink
Merge pull request #7 from smithki/development
Browse files Browse the repository at this point in the history
Release v2.0.2
  • Loading branch information
smithki authored Oct 14, 2019
2 parents 2e88091 + 4f9ecc1 commit e3e6a06
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "watch-resize",
"version": "2.0.1",
"version": "2.0.2",
"description": "Watch any DOM element for size changes using Observables.",
"author": "Ian K Smith <[email protected]>",
"license": "MIT",
Expand Down
17 changes: 13 additions & 4 deletions src/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,22 @@ export function watchResize<T extends HTMLElement>(

// Create a nested browsing context using an <object> element.
const obj = document.createElement('object');
obj.setAttribute(
'style',
'display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; pointer-events: none; z-index: -1;',
);

// Set type and data
obj.type = 'text/html';
obj.data = 'about:blank';

// Set CSSOM properties
obj.style.display = 'block';
obj.style.position = 'absolute';
obj.style.top = '0';
obj.style.left = '0';
obj.style.height = '100%';
obj.style.width = '100%';
obj.style.overflow = 'hidden';
obj.style.pointerEvents = 'none';
obj.style.zIndex = '-1';

// Store some data that will change with the observable.
const subscribers: Subscriber<WatchResizePayload<T>>[] = [];
let prevBoundingClientRect:
Expand Down

0 comments on commit e3e6a06

Please sign in to comment.