Skip to content

Commit

Permalink
support innerHTML for title and style
Browse files Browse the repository at this point in the history
  • Loading branch information
gnoff committed Feb 8, 2023
1 parent 6c56d8d commit 6cdf51a
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1606,6 +1606,7 @@ function pushStyleImpl(
target.push(startChunkForTag('style'));

let children = null;
let innerHTML = null;
for (const propKey in props) {
if (hasOwnProperty.call(props, propKey)) {
const propValue = props[propKey];
Expand All @@ -1617,9 +1618,8 @@ function pushStyleImpl(
children = propValue;
break;
case 'dangerouslySetInnerHTML':
throw new Error(
'`dangerouslySetInnerHTML` does not make sense on <title>.',
);
innerHTML = propValue;
break;
default:
pushAttribute(target, propKey, propValue);
break;
Expand All @@ -1642,6 +1642,7 @@ function pushStyleImpl(
// eslint-disable-next-line react-internal/safe-string-coercion
target.push(stringToChunk(escapeTextForBrowser('' + child)));
}
pushInnerHTML(target, innerHTML, children);
target.push(endTag1, stringToChunk('style'), endTag2);
return null;
}
Expand Down Expand Up @@ -1782,6 +1783,7 @@ function pushTitleImpl(
target.push(startChunkForTag('title'));

let children = null;
let innerHTML = null;
for (const propKey in props) {
if (hasOwnProperty.call(props, propKey)) {
const propValue = props[propKey];
Expand All @@ -1793,9 +1795,8 @@ function pushTitleImpl(
children = propValue;
break;
case 'dangerouslySetInnerHTML':
throw new Error(
'`dangerouslySetInnerHTML` does not make sense on <title>.',
);
innerHTML = propValue;
break;
default:
pushAttribute(target, propKey, propValue);
break;
Expand All @@ -1818,6 +1819,7 @@ function pushTitleImpl(
// eslint-disable-next-line react-internal/safe-string-coercion
target.push(stringToChunk(escapeTextForBrowser('' + child)));
}
pushInnerHTML(target, innerHTML, children);
target.push(endTag1, stringToChunk('title'), endTag2);
return null;
}
Expand Down

0 comments on commit 6cdf51a

Please sign in to comment.