( target: Array<Chunk | PrecomputedChunk>, innerHTML: any, children: any, )
| 1851 | const endOfStartTagSelfClosing = stringToPrecomputedChunk('/>'); |
| 1852 | |
| 1853 | function pushInnerHTML( |
| 1854 | target: Array<Chunk | PrecomputedChunk>, |
| 1855 | innerHTML: any, |
| 1856 | children: any, |
| 1857 | ) { |
| 1858 | if (innerHTML != null) { |
| 1859 | if (children != null) { |
| 1860 | throw new Error( |
| 1861 | 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.', |
| 1862 | ); |
| 1863 | } |
| 1864 | |
| 1865 | if (typeof innerHTML !== 'object' || !('__html' in innerHTML)) { |
| 1866 | throw new Error( |
| 1867 | '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' + |
| 1868 | 'Please visit https://react.dev/link/dangerously-set-inner-html ' + |
| 1869 | 'for more information.', |
| 1870 | ); |
| 1871 | } |
| 1872 | |
| 1873 | const html = innerHTML.__html; |
| 1874 | if (html !== null && html !== undefined) { |
| 1875 | if (__DEV__) { |
| 1876 | checkHtmlStringCoercion(html); |
| 1877 | } |
| 1878 | target.push(stringToChunk('' + html)); |
| 1879 | } |
| 1880 | } |
| 1881 | } |
| 1882 | |
| 1883 | // TODO: Move these to RenderState so that we warn for every request. |
| 1884 | // It would help debugging in stateful servers (e.g. service worker). |
no test coverage detected