New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-frame-component

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-frame-component - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

4

lib/Frame.js

@@ -114,2 +114,6 @@ 'use strict';

if (doc && doc.readyState === 'complete') {
if (doc.querySelector('div') === null) {
this._setInitialContent = false;
}
var win = doc.defaultView || doc.parentView;

@@ -116,0 +120,0 @@ var initialRender = !this._setInitialContent;

2

package.json
{
"name": "react-frame-component",
"version": "1.0.1",
"version": "1.0.2",
"description": "React component to wrap your application or component in an iFrame for encapsulation purposes",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -82,2 +82,19 @@ # React <Frame /> component

######Accessing the iframe's window and document
The iframe's `window` and `document` may be accessed via the React context values `window` and `document` respectively.
```
const MyComponent = (props, context) => {
const {
document: iframeDocument,
window: iframeWindow
} = context;
return (<...rendered jsx.../>);
};
MyComponent.contextTypes = {
window: PropTypes.any,
document: PropTypes.any
};
```
## More info

@@ -84,0 +101,0 @@

@@ -93,2 +93,6 @@ import React, { Component, PropTypes } from 'react';

if (doc && doc.readyState === 'complete') {
if (doc.querySelector('div') === null) {
this._setInitialContent = false;
}
const win = doc.defaultView || doc.parentView;

@@ -95,0 +99,0 @@ const initialRender = !this._setInitialContent;

@@ -271,2 +271,45 @@ import React, { PropTypes } from 'react';

});
it('should not error when parent components are reused', () => {
div = document.body.appendChild(document.createElement('div'));
const component = ReactDOM.render(
<ul className="container">
<li key="1">
<Frame>
<p>Text 1</p>
</Frame>
</li>
<li key="2">
<Frame>
<p>Text 2</p>
</Frame>
</li>
</ul>,
div
);
const iframes1 = ReactDOM.findDOMNode(component).querySelectorAll('iframe');
expect(iframes1[0].contentDocument.body.querySelector('p').textContent).to.equal('Text 1');
expect(iframes1[1].contentDocument.body.querySelector('p').textContent).to.equal('Text 2');
const component2 = ReactDOM.render(
<ul className="container">
<li key="2">
<Frame>
<p>Text 2</p>
</Frame>
</li>
<li key="1">
<Frame>
<p>Text 1</p>
</Frame>
</li>
</ul>,
div,
);
const iframes2 = ReactDOM.findDOMNode(component2).querySelectorAll('iframe');
expect(iframes2[0].contentDocument.body.querySelector('p').textContent).to.equal('Text 2');
expect(iframes2[1].contentDocument.body.querySelector('p').textContent).to.equal('Text 1');
});
});
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