mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Expose new DOM classes in the global scope (#49697)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/49697 Changelog: [internal] These classes cannot be instantiated directly, but having access to them allows users to do `instanceof` checks, e.g.: ``` if (ref.current instanceof Element) { ref.current.getBoundingClientRect(); } ``` Reviewed By: yungsters Differential Revision: D70244966 fbshipit-source-id: 3c1e3698b8851ef9ce3c2865e7435b000984c8f0
This commit is contained in:
committed by
Facebook GitHub Bot
parent
66495830c0
commit
a6dd18c2a6
+36
-1
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow strict
|
||||
* @flow strict-local
|
||||
* @format
|
||||
*/
|
||||
|
||||
@@ -29,6 +29,11 @@ export default function setUpDOM() {
|
||||
() => require('../webapis/geometry/DOMRectReadOnly').default,
|
||||
);
|
||||
|
||||
polyfillGlobal(
|
||||
'DOMRectList',
|
||||
() => require('../webapis/geometry/DOMRectList').default,
|
||||
);
|
||||
|
||||
polyfillGlobal(
|
||||
'HTMLCollection',
|
||||
() => require('../webapis/dom/oldstylecollections/HTMLCollection').default,
|
||||
@@ -38,4 +43,34 @@ export default function setUpDOM() {
|
||||
'NodeList',
|
||||
() => require('../webapis/dom/oldstylecollections/NodeList').default,
|
||||
);
|
||||
|
||||
polyfillGlobal(
|
||||
'Node',
|
||||
() => require('../webapis/dom/nodes/ReadOnlyNode').default,
|
||||
);
|
||||
|
||||
polyfillGlobal(
|
||||
'Document',
|
||||
() => require('../webapis/dom/nodes/ReactNativeDocument').default,
|
||||
);
|
||||
|
||||
polyfillGlobal(
|
||||
'CharacterData',
|
||||
() => require('../webapis/dom/nodes/ReadOnlyCharacterData').default,
|
||||
);
|
||||
|
||||
polyfillGlobal(
|
||||
'Text',
|
||||
() => require('../webapis/dom/nodes/ReadOnlyText').default,
|
||||
);
|
||||
|
||||
polyfillGlobal(
|
||||
'Element',
|
||||
() => require('../webapis/dom/nodes/ReadOnlyElement').default,
|
||||
);
|
||||
|
||||
polyfillGlobal(
|
||||
'HTMLElement',
|
||||
() => require('../webapis/dom/nodes/ReactNativeElement').default,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user