Comparing version 5.28.0 to 5.29.0
import React from 'react'; | ||
export declare function isDOM(node: any): boolean; | ||
/** | ||
* Return if a node is a DOM node. Else will return by `findDOMNode` | ||
*/ | ||
export default function findDOMNode<T = Element | Text>(node: React.ReactInstance | HTMLElement): T; | ||
export default function findDOMNode<T = Element | Text>(node: React.ReactInstance | HTMLElement | SVGElement): T; |
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
export function isDOM(node) { | ||
// https://developer.mozilla.org/en-US/docs/Web/API/Element | ||
// Since XULElement is also subclass of Element, we only need HTMLElement and SVGElement | ||
return node instanceof HTMLElement || node instanceof SVGElement; | ||
} | ||
@@ -8,3 +13,3 @@ /** | ||
export default function findDOMNode(node) { | ||
if (node instanceof HTMLElement) { | ||
if (isDOM(node)) { | ||
return node; | ||
@@ -11,0 +16,0 @@ } |
import React from 'react'; | ||
export declare function isDOM(node: any): boolean; | ||
/** | ||
* Return if a node is a DOM node. Else will return by `findDOMNode` | ||
*/ | ||
export default function findDOMNode<T = Element | Text>(node: React.ReactInstance | HTMLElement): T; | ||
export default function findDOMNode<T = Element | Text>(node: React.ReactInstance | HTMLElement | SVGElement): T; |
@@ -8,4 +8,11 @@ "use strict"; | ||
exports.default = findDOMNode; | ||
exports.isDOM = isDOM; | ||
var _react = _interopRequireDefault(require("react")); | ||
var _reactDom = _interopRequireDefault(require("react-dom")); | ||
function isDOM(node) { | ||
// https://developer.mozilla.org/en-US/docs/Web/API/Element | ||
// Since XULElement is also subclass of Element, we only need HTMLElement and SVGElement | ||
return node instanceof HTMLElement || node instanceof SVGElement; | ||
} | ||
/** | ||
@@ -15,3 +22,3 @@ * Return if a node is a DOM node. Else will return by `findDOMNode` | ||
function findDOMNode(node) { | ||
if (node instanceof HTMLElement) { | ||
if (isDOM(node)) { | ||
return node; | ||
@@ -18,0 +25,0 @@ } |
{ | ||
"name": "rc-util", | ||
"version": "5.28.0", | ||
"version": "5.29.0", | ||
"description": "Common Utils For React Component", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
214312
6610
0