Skip to content

Commit

Permalink
Allow dangerouslySetInnerHTML in <option> (facebook#21373)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebmarkbage authored and koto committed Jun 15, 2021
1 parent 21922b8 commit 1045d46
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/react-dom/src/server/ReactDOMServerFormatConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,7 @@ function pushStartOption(
let children = null;
let value = null;
let selected = null;
let innerHTML = null;
for (const propKey in props) {
if (hasOwnProperty.call(props, propKey)) {
const propValue = props[propKey];
Expand All @@ -716,10 +717,8 @@ function pushStartOption(
}
break;
case 'dangerouslySetInnerHTML':
invariant(
false,
'`dangerouslySetInnerHTML` does not work on <option>.',
);
innerHTML = propValue;
break;
// eslint-disable-next-line-no-fallthrough
case 'value':
value = propValue;
Expand Down Expand Up @@ -760,6 +759,7 @@ function pushStartOption(
}

target.push(endOfStartTag);
pushInnerHTML(target, innerHTML, children);
return children;
}

Expand Down

0 comments on commit 1045d46

Please sign in to comment.