swiftcarrot / react-frame

React components within an iframe for isolated css styling

Home Page:https://swiftcarrot.dev/react-frame

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Style tag inserted in head before <link> stylesheets (on IE browsers)

maciekmp opened this issue · comments

Hey,

I am using newest version of this component. It works great but I found one little issue. In my iframe I have base styles in files and few customized added to iframe via css prop. On IE style tag is the first element in head - on other browsers is after link tags.

Right now I use setTimeout to delay adding style to head but maybe someone know better solution.

renderFrame: function renderFrame() {
    var frame = ReactDOM.findDOMNode(this);
    this.head = frame.contentDocument.head;
    this.body = frame.contentDocument.body;

    this.updateStylesheets(this.props.styleSheets);
    setTimeout(function(){
      this.updateCss(this.props.css);
    }.bind(this),0);

    ReactDOM.render(this._children, this.body);
}

This doesnt seem like a hack to me.

fixed in 2.1.0