mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Merge pull request #5146 from spicyj/ce-scripts
Don't execute <script> tags w/ createElement mode
This commit is contained in:
@@ -630,7 +630,16 @@ ReactDOMComponent.Mixin = {
|
||||
var ownerDocument = nativeContainerInfo._ownerDocument;
|
||||
var el;
|
||||
if (namespaceURI === DOMNamespaces.html) {
|
||||
el = ownerDocument.createElement(this._currentElement.type);
|
||||
if (this._tag === 'script') {
|
||||
// Create the script via .innerHTML so its "parser-inserted" flag is
|
||||
// set to true and it does not execute
|
||||
var div = ownerDocument.createElement('div');
|
||||
var type = this._currentElement.type;
|
||||
div.innerHTML = `<${type}></${type}>`;
|
||||
el = div.removeChild(div.firstChild);
|
||||
} else {
|
||||
el = ownerDocument.createElement(this._currentElement.type);
|
||||
}
|
||||
} else {
|
||||
el = ownerDocument.createElementNS(
|
||||
namespaceURI,
|
||||
|
||||
Reference in New Issue
Block a user