main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
1.3 KB
|
Line | |
---|
1 | import {createReadOnlyRect} from './utils/geometry.js';
|
---|
2 | import defineConfigurable from './utils/defineConfigurable.js';
|
---|
3 |
|
---|
4 | export default class ResizeObserverEntry {
|
---|
5 | /**
|
---|
6 | * Element size of which has changed.
|
---|
7 | * Spec: https://wicg.github.io/ResizeObserver/#dom-resizeobserverentry-target
|
---|
8 | *
|
---|
9 | * @readonly
|
---|
10 | * @type {Element}
|
---|
11 | */
|
---|
12 | target;
|
---|
13 |
|
---|
14 | /**
|
---|
15 | * Element's content rectangle.
|
---|
16 | * Spec: https://wicg.github.io/ResizeObserver/#dom-resizeobserverentry-contentrect
|
---|
17 | *
|
---|
18 | * @readonly
|
---|
19 | * @type {DOMRectReadOnly}
|
---|
20 | */
|
---|
21 | contentRect;
|
---|
22 |
|
---|
23 | /**
|
---|
24 | * Creates an instance of ResizeObserverEntry.
|
---|
25 | *
|
---|
26 | * @param {Element} target - Element that is being observed.
|
---|
27 | * @param {DOMRectInit} rectInit - Data of the element's content rectangle.
|
---|
28 | */
|
---|
29 | constructor(target, rectInit) {
|
---|
30 | const contentRect = createReadOnlyRect(rectInit);
|
---|
31 |
|
---|
32 | // According to the specification following properties are not writable
|
---|
33 | // and are also not enumerable in the native implementation.
|
---|
34 | //
|
---|
35 | // Property accessors are not being used as they'd require to define a
|
---|
36 | // private WeakMap storage which may cause memory leaks in browsers that
|
---|
37 | // don't support this type of collections.
|
---|
38 | defineConfigurable(this, {target, contentRect});
|
---|
39 | }
|
---|
40 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.