Allow dangerouslySetInnerHTML in <option> (#21373)

This commit is contained in:
Sebastian Markbåge
2021-05-04 07:45:54 -07:00
committed by GitHub
parent 9a130e1dec
commit 442eb21e0e
@@ -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];
@@ -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;
@@ -760,6 +759,7 @@ function pushStartOption(
}
target.push(endOfStartTag);
pushInnerHTML(target, innerHTML, children);
return children;
}