Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-portal

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-portal - npm Package Compare versions

Comparing version 2.1.4 to 2.2.0

27

build/portal.js

@@ -183,2 +183,15 @@ 'use strict';

}, {
key: 'applyClassNameAndStyle',
value: function applyClassNameAndStyle(props) {
if (props.className) {
this.node.className = props.className;
}
if (props.style) {
// React 15.1.0+ requires third parameter in debug mode
/* eslint-disable no-underscore-dangle */
_CSSPropertyOperations2.default.setValueForStyles(this.node, props.style, this._reactInternalInstance);
/* eslint-enable no-underscore-dangle */
}
}
}, {
key: 'renderPortal',

@@ -188,12 +201,8 @@ value: function renderPortal(props) {

this.node = document.createElement('div');
if (props.className) {
this.node.className = props.className;
}
if (props.style) {
// React 15.1.0+ requires third parameter in debug mode
/* eslint-disable no-underscore-dangle */
_CSSPropertyOperations2.default.setValueForStyles(this.node, props.style, this._reactInternalInstance);
/* eslint-enable no-underscore-dangle */
}
// apply CSS before the node is added to the DOM to avoid needless reflows
this.applyClassNameAndStyle(props);
document.body.appendChild(this.node);
} else {
// update CSS when new props arrive
this.applyClassNameAndStyle(props);
}

@@ -200,0 +209,0 @@ this.portal = _reactDom2.default.unstable_renderSubtreeIntoContainer(this, _react2.default.cloneElement(props.children, { closePortal: this.closePortal }), this.node, this.props.onUpdate);

@@ -129,17 +129,25 @@ import React from 'react';

applyClassNameAndStyle(props) {
if (props.className) {
this.node.className = props.className;
}
if (props.style) {
// React 15.1.0+ requires third parameter in debug mode
/* eslint-disable no-underscore-dangle */
CSSPropertyOperations.setValueForStyles(this.node,
props.style,
this._reactInternalInstance);
/* eslint-enable no-underscore-dangle */
}
}
renderPortal(props) {
if (!this.node) {
this.node = document.createElement('div');
if (props.className) {
this.node.className = props.className;
}
if (props.style) {
// React 15.1.0+ requires third parameter in debug mode
/* eslint-disable no-underscore-dangle */
CSSPropertyOperations.setValueForStyles(this.node,
props.style,
this._reactInternalInstance);
/* eslint-enable no-underscore-dangle */
}
// apply CSS before the node is added to the DOM to avoid needless reflows
this.applyClassNameAndStyle(props);
document.body.appendChild(this.node);
} else {
// update CSS when new props arrive
this.applyClassNameAndStyle(props);
}

@@ -146,0 +154,0 @@ this.portal = ReactDOM.unstable_renderSubtreeIntoContainer(

{
"name": "react-portal",
"version": "2.1.4",
"version": "2.2.0",
"description": "React component for transportation of modals, lightboxes, loading bars... to document.body",

@@ -5,0 +5,0 @@ "main": "build/portal",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc