code
stringlengths
24
2.07M
docstring
stringlengths
25
85.3k
func_name
stringlengths
1
92
language
stringclasses
1 value
repo
stringlengths
5
64
path
stringlengths
4
172
url
stringlengths
44
218
license
stringclasses
7 values
function Child() { return ( <span ariaTypo4="no">{ReactDOMServer.renderToString(<App2 />)}</span> ); }
We need to make sure that updates occur to the actual node that's in the DOM, instead of a stale cache.
Child
javascript
facebook/react
packages/react-dom/src/__tests__/ReactDOM-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactDOM-test.js
MIT
function ServerEntry() { return ReactDOMServer.renderToString(<Child />); }
We need to make sure that updates occur to the actual node that's in the DOM, instead of a stale cache.
ServerEntry
javascript
facebook/react
packages/react-dom/src/__tests__/ReactDOM-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactDOM-test.js
MIT
function App() { return ( <div> <span ariaTypo="no" /> <ServerEntry /> <font ariaTypo5="no" /> </div> ); }
We need to make sure that updates occur to the actual node that's in the DOM, instead of a stale cache.
App
javascript
facebook/react
packages/react-dom/src/__tests__/ReactDOM-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactDOM-test.js
MIT
function App({phase}) { return ( <> {phase < 1 ? null : <div>..before</div>} {phase < 3 ? <div>before</div> : null} {phase < 2 ? null : <div>before..</div>} <html lang="en"> <head data-h=""> {phase < 1 ? null : <meta itemProp="" content=".....
We need to make sure that updates occur to the actual node that's in the DOM, instead of a stale cache.
App
javascript
facebook/react
packages/react-dom/src/__tests__/ReactDOM-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactDOM-test.js
MIT
function App({phase}) { return ( <> {phase < 1 ? null : <div>..before</div>} {phase < 3 ? <div>before</div> : null} {phase < 2 ? null : <div>before..</div>} <head data-h=""> {phase < 1 ? null : <meta itemProp="" content="..head" />} {phase < ...
We need to make sure that updates occur to the actual node that's in the DOM, instead of a stale cache.
App
javascript
facebook/react
packages/react-dom/src/__tests__/ReactDOM-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactDOM-test.js
MIT
function App({phase}) { return ( <> {phase < 1 ? null : <div>..before</div>} {phase < 3 ? <div>before</div> : null} {phase < 2 ? null : <div>before..</div>} <head data-h=""> {phase < 1 ? null : <meta itemProp="" content="..head" />} {phase < ...
We need to make sure that updates occur to the actual node that's in the DOM, instead of a stale cache.
App
javascript
facebook/react
packages/react-dom/src/__tests__/ReactDOM-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactDOM-test.js
MIT
function App({phase}) { return ( <> <div>before</div> <head data-h=""> {phase < 1 ? null : <meta itemProp="" content="..head" />} {phase < 3 ? <meta itemProp="" content="head" /> : null} {phase < 2 ? null : <meta itemProp="" content="head.." />} ...
We need to make sure that updates occur to the actual node that's in the DOM, instead of a stale cache.
App
javascript
facebook/react
packages/react-dom/src/__tests__/ReactDOM-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactDOM-test.js
MIT
function createNewPromise() { currentPromise = new Promise(r => { resolveCurrentPromise = r; }); return currentPromise; }
We need to make sure that updates occur to the actual node that's in the DOM, instead of a stale cache.
createNewPromise
javascript
facebook/react
packages/react-dom/src/__tests__/ReactDOM-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactDOM-test.js
MIT
function Comp() { const [promise, setPromise] = React.useState(currentPromise); suspendOnNewPromise = () => { setPromise(createNewPromise()); }; React.use(promise); return null; }
We need to make sure that updates occur to the actual node that's in the DOM, instead of a stale cache.
Comp
javascript
facebook/react
packages/react-dom/src/__tests__/ReactDOM-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactDOM-test.js
MIT
function createNewMessage() { currentMessage = new Promise(r => { resolveCurrentMessage = r; }); return currentMessage; }
We need to make sure that updates occur to the actual node that's in the DOM, instead of a stale cache.
createNewMessage
javascript
facebook/react
packages/react-dom/src/__tests__/ReactDOM-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactDOM-test.js
MIT
function Message() { const [pendingMessage, setPendingMessage] = React.useState(currentMessage); suspendOnNewMessage = () => { setPendingMessage(createNewMessage()); }; return React.use(pendingMessage); }
We need to make sure that updates occur to the actual node that's in the DOM, instead of a stale cache.
Message
javascript
facebook/react
packages/react-dom/src/__tests__/ReactDOM-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactDOM-test.js
MIT
function App() { return ( <React.Suspense fallback={fallback}> <Comp /> {main} </React.Suspense> ); }
We need to make sure that updates occur to the actual node that's in the DOM, instead of a stale cache.
App
javascript
facebook/react
packages/react-dom/src/__tests__/ReactDOM-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactDOM-test.js
MIT
function App() { return ( <html> <body> <Suspense fallback={ <> <div>fallback1</div> <meta name="fallback1" /> <title>foo</title> </> }> <> ...
TO HERE: The client render patches in the two missing preinit stylesheets when hydration happens Note that this is only because we repeated the calls to preinit on the client
App
javascript
facebook/react
packages/react-dom/src/__tests__/ReactDOMFloat-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactDOMFloat-test.js
MIT
function App() { return ( <html> <body> <Suspense fallback={ <Suspense fallback={ <> <div>nested fallback1</div> <meta name="nested fallback1" /> </> ...
TO HERE: The client render patches in the two missing preinit stylesheets when hydration happens Note that this is only because we repeated the calls to preinit on the client
App
javascript
facebook/react
packages/react-dom/src/__tests__/ReactDOMFloat-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactDOMFloat-test.js
MIT
function App() { ReactDOM.preinit('foo', {as: 'script'}); React.use(promise); return ( <html> <body>hello</body> </html> ); }
TO HERE: The client render patches in the two missing preinit stylesheets when hydration happens Note that this is only because we repeated the calls to preinit on the client
App
javascript
facebook/react
packages/react-dom/src/__tests__/ReactDOMFloat-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactDOMFloat-test.js
MIT
function App({url}) { ReactDOM.prefetchDNS(url); ReactDOM.prefetchDNS(url); ReactDOM.prefetchDNS(url, {}); ReactDOM.prefetchDNS(url, {crossOrigin: 'use-credentials'}); return ( <html> <body>hello world</body> </html> ); }
TO HERE: The client render patches in the two missing preinit stylesheets when hydration happens Note that this is only because we repeated the calls to preinit on the client
App
javascript
facebook/react
packages/react-dom/src/__tests__/ReactDOMFloat-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactDOMFloat-test.js
MIT
function Unblock({value}) { resolveText(value); return null; }
TO HERE: The client render patches in the two missing preinit stylesheets when hydration happens Note that this is only because we repeated the calls to preinit on the client
Unblock
javascript
facebook/react
packages/react-dom/src/__tests__/ReactDOMFloat-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactDOMFloat-test.js
MIT
function App() { return ( <html> <body> <Suspense fallback="loading..."> <div>hello world</div> <BlockedOn value="unblock inner boundaries"> <Suspense fallback={ <> <link ...
TO HERE: The client render patches in the two missing preinit stylesheets when hydration happens Note that this is only because we repeated the calls to preinit on the client
App
javascript
facebook/react
packages/react-dom/src/__tests__/ReactDOMFloat-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactDOMFloat-test.js
MIT
function App({url}) { ReactDOM.preconnect(url); ReactDOM.preconnect(url); ReactDOM.preconnect(url, {crossOrigin: true}); ReactDOM.preconnect(url, {crossOrigin: ''}); ReactDOM.preconnect(url, {crossOrigin: 'anonymous'}); ReactDOM.preconnect(url, {crossOrigin: 'use-credenti...
TO HERE: The client render patches in the two missing preinit stylesheets when hydration happens Note that this is only because we repeated the calls to preinit on the client
App
javascript
facebook/react
packages/react-dom/src/__tests__/ReactDOMFloat-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactDOMFloat-test.js
MIT
function App() { ReactDOM.preload('foo', {as: 'style'}); return ( <html> <body> <Suspense fallback="loading..."> <BlockedOn value="blocked"> <Component /> </BlockedOn> </Suspense> </body> ...
TO HERE: The client render patches in the two missing preinit stylesheets when hydration happens Note that this is only because we repeated the calls to preinit on the client
App
javascript
facebook/react
packages/react-dom/src/__tests__/ReactDOMFloat-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactDOMFloat-test.js
MIT
function Component() { ReactDOM.preload('bar', {as: 'script'}); return <div>hello</div>; }
TO HERE: The client render patches in the two missing preinit stylesheets when hydration happens Note that this is only because we repeated the calls to preinit on the client
Component
javascript
facebook/react
packages/react-dom/src/__tests__/ReactDOMFloat-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactDOMFloat-test.js
MIT
function ClientApp() { ReactDOM.preload('foo', {as: 'style'}); ReactDOM.preload('font', {as: 'font', type: 'font/woff2'}); React.useInsertionEffect(() => ReactDOM.preload('bar', {as: 'script'})); React.useLayoutEffect(() => ReactDOM.preload('baz', {as: 'font'})); React.useEffect(...
TO HERE: The client render patches in the two missing preinit stylesheets when hydration happens Note that this is only because we repeated the calls to preinit on the client
ClientApp
javascript
facebook/react
packages/react-dom/src/__tests__/ReactDOMFloat-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactDOMFloat-test.js
MIT
function App() { ReactDOM.preload('foo', { as: 'style', crossOrigin: 'use-credentials', integrity: 'some hash', fetchPriority: 'low', }); return ( <html> <body> <div>hello</div> <link rel="stylesheet" href=...
TO HERE: The client render patches in the two missing preinit stylesheets when hydration happens Note that this is only because we repeated the calls to preinit on the client
App
javascript
facebook/react
packages/react-dom/src/__tests__/ReactDOMFloat-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactDOMFloat-test.js
MIT
function App() { ReactDOM.preload(); ReactDOM.preload(''); ReactDOM.preload('foo', null); ReactDOM.preload('foo', {}); ReactDOM.preload('foo', {as: 'foo'}); return <div>foo</div>; }
TO HERE: The client render patches in the two missing preinit stylesheets when hydration happens Note that this is only because we repeated the calls to preinit on the client
App
javascript
facebook/react
packages/react-dom/src/__tests__/ReactDOMFloat-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactDOMFloat-test.js
MIT
function Component({isServer}) { ReactDOM.preload(isServer ? 'highserver' : 'highclient', { as: 'script', fetchPriority: 'high', }); ReactDOM.preload(isServer ? 'lowserver' : 'lowclient', { as: 'style', fetchPriority: 'low', }); ReactDOM.pr...
TO HERE: The client render patches in the two missing preinit stylesheets when hydration happens Note that this is only because we repeated the calls to preinit on the client
Component
javascript
facebook/react
packages/react-dom/src/__tests__/ReactDOMFloat-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactDOMFloat-test.js
MIT
function App({url}) { ReactDOM.preload(url, {as: 'script', nonce: 'abc'}); return 'hello'; }
TO HERE: The client render patches in the two missing preinit stylesheets when hydration happens Note that this is only because we repeated the calls to preinit on the client
App
javascript
facebook/react
packages/react-dom/src/__tests__/ReactDOMFloat-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactDOMFloat-test.js
MIT
function App({ssr}) { const prefix = ssr ? 'ssr ' : 'browser '; ReactDOM.preloadModule(prefix + 'plain'); ReactDOM.preloadModule(prefix + 'default', {as: 'script'}); ReactDOM.preloadModule(prefix + 'cors', { crossOrigin: 'use-credentials', }); ReactDOM.preloadMo...
TO HERE: The client render patches in the two missing preinit stylesheets when hydration happens Note that this is only because we repeated the calls to preinit on the client
App
javascript
facebook/react
packages/react-dom/src/__tests__/ReactDOMFloat-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactDOMFloat-test.js
MIT
function App() { ReactDOM.preloadModule(); ReactDOM.preloadModule(() => {}); ReactDOM.preloadModule(''); ReactDOM.preloadModule('1', true); ReactDOM.preloadModule('2', {as: true}); return <div>hello</div>; }
TO HERE: The client render patches in the two missing preinit stylesheets when hydration happens Note that this is only because we repeated the calls to preinit on the client
App
javascript
facebook/react
packages/react-dom/src/__tests__/ReactDOMFloat-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactDOMFloat-test.js
MIT
function App() { ReactDOM.preinit('foo', {as: 'style'}); return ( <html> <body> <Suspense fallback="loading..."> <BlockedOn value="bar"> <Component /> </BlockedOn> </Suspense> </body> ...
TO HERE: The client render patches in the two missing preinit stylesheets when hydration happens Note that this is only because we repeated the calls to preinit on the client
App
javascript
facebook/react
packages/react-dom/src/__tests__/ReactDOMFloat-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactDOMFloat-test.js
MIT
function Component() { ReactDOM.preinit('bar', {as: 'style'}); return <div>hello</div>; }
TO HERE: The client render patches in the two missing preinit stylesheets when hydration happens Note that this is only because we repeated the calls to preinit on the client
Component
javascript
facebook/react
packages/react-dom/src/__tests__/ReactDOMFloat-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactDOMFloat-test.js
MIT
function ClientApp() { ReactDOM.preinit('bar', {as: 'style'}); return ( <html> <body> <Suspense fallback="loading..."> <div>hello</div> </Suspense> </body> </html> ); }
TO HERE: The client render patches in the two missing preinit stylesheets when hydration happens Note that this is only because we repeated the calls to preinit on the client
ClientApp
javascript
facebook/react
packages/react-dom/src/__tests__/ReactDOMFloat-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactDOMFloat-test.js
MIT
function App() { React.useEffect(() => { ReactDOM.preinit('foo', {as: 'style'}); }, []); return ( <html> <body>foo</body> </html> ); }
TO HERE: The client render patches in the two missing preinit stylesheets when hydration happens Note that this is only because we repeated the calls to preinit on the client
App
javascript
facebook/react
packages/react-dom/src/__tests__/ReactDOMFloat-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactDOMFloat-test.js
MIT
function ShadowComponent() { ReactDOM.preinit('bar', {as: 'style'}); return null; }
TO HERE: The client render patches in the two missing preinit stylesheets when hydration happens Note that this is only because we repeated the calls to preinit on the client
ShadowComponent
javascript
facebook/react
packages/react-dom/src/__tests__/ReactDOMFloat-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactDOMFloat-test.js
MIT
function App() { React.useEffect(() => { ReactDOM.preinit('foo', {as: 'style'}); }, []); return ( <html> <body> foo {ReactDOM.createPortal( <div> <ShadowComponent /> shadow ...
TO HERE: The client render patches in the two missing preinit stylesheets when hydration happens Note that this is only because we repeated the calls to preinit on the client
App
javascript
facebook/react
packages/react-dom/src/__tests__/ReactDOMFloat-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactDOMFloat-test.js
MIT
function App() { ReactDOM.preinit('foo', {as: 'script'}); return ( <html> <body> <Suspense fallback="loading..."> <BlockedOn value="bar"> <Component /> </BlockedOn> </Suspense> </body> ...
TO HERE: The client render patches in the two missing preinit stylesheets when hydration happens Note that this is only because we repeated the calls to preinit on the client
App
javascript
facebook/react
packages/react-dom/src/__tests__/ReactDOMFloat-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactDOMFloat-test.js
MIT
function Component() { ReactDOM.preinit('bar', {as: 'script'}); return <div>hello</div>; }
TO HERE: The client render patches in the two missing preinit stylesheets when hydration happens Note that this is only because we repeated the calls to preinit on the client
Component
javascript
facebook/react
packages/react-dom/src/__tests__/ReactDOMFloat-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactDOMFloat-test.js
MIT
function ClientApp() { ReactDOM.preinit('bar', {as: 'script'}); return ( <html> <body> <Suspense fallback="loading..."> <div>hello</div> </Suspense> </body> </html> ); }
TO HERE: The client render patches in the two missing preinit stylesheets when hydration happens Note that this is only because we repeated the calls to preinit on the client
ClientApp
javascript
facebook/react
packages/react-dom/src/__tests__/ReactDOMFloat-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactDOMFloat-test.js
MIT
function App() { React.useEffect(() => { ReactDOM.preinit('foo', {as: 'script'}); }, []); return ( <html> <body>foo</body> </html> ); }
TO HERE: The client render patches in the two missing preinit stylesheets when hydration happens Note that this is only because we repeated the calls to preinit on the client
App
javascript
facebook/react
packages/react-dom/src/__tests__/ReactDOMFloat-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactDOMFloat-test.js
MIT
function App() { ReactDOM.preinit(); ReactDOM.preinit(''); ReactDOM.preinit('foo', null); ReactDOM.preinit('foo', {}); ReactDOM.preinit('foo', {as: 'foo'}); return <div>foo</div>; }
TO HERE: The client render patches in the two missing preinit stylesheets when hydration happens Note that this is only because we repeated the calls to preinit on the client
App
javascript
facebook/react
packages/react-dom/src/__tests__/ReactDOMFloat-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactDOMFloat-test.js
MIT
function Component({src}) { ReactDOM.preinit(src, {as: 'script', nonce: 'R4nD0m'}); return 'hello'; }
TO HERE: The client render patches in the two missing preinit stylesheets when hydration happens Note that this is only because we repeated the calls to preinit on the client
Component
javascript
facebook/react
packages/react-dom/src/__tests__/ReactDOMFloat-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactDOMFloat-test.js
MIT
function Component({src, hash}) { ReactDOM.preinit(src, {as: 'script', integrity: hash}); return 'hello'; }
TO HERE: The client render patches in the two missing preinit stylesheets when hydration happens Note that this is only because we repeated the calls to preinit on the client
Component
javascript
facebook/react
packages/react-dom/src/__tests__/ReactDOMFloat-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactDOMFloat-test.js
MIT
function Component({src, hash}) { ReactDOM.preinit(src, {as: 'style', integrity: hash}); return 'hello'; }
TO HERE: The client render patches in the two missing preinit stylesheets when hydration happens Note that this is only because we repeated the calls to preinit on the client
Component
javascript
facebook/react
packages/react-dom/src/__tests__/ReactDOMFloat-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactDOMFloat-test.js
MIT
function Component({isServer}) { ReactDOM.preinit(isServer ? 'highserver' : 'highclient', { as: 'script', fetchPriority: 'high', }); ReactDOM.preinit(isServer ? 'lowserver' : 'lowclient', { as: 'style', fetchPriority: 'low', }); ReactDOM.pr...
TO HERE: The client render patches in the two missing preinit stylesheets when hydration happens Note that this is only because we repeated the calls to preinit on the client
Component
javascript
facebook/react
packages/react-dom/src/__tests__/ReactDOMFloat-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactDOMFloat-test.js
MIT
function App({ssr}) { const prefix = ssr ? 'ssr ' : 'browser '; ReactDOM.preinitModule(prefix + 'plain'); ReactDOM.preinitModule(prefix + 'default', {as: 'script'}); ReactDOM.preinitModule(prefix + 'cors', { crossOrigin: 'use-credentials', }); ReactDOM.preinitMo...
TO HERE: The client render patches in the two missing preinit stylesheets when hydration happens Note that this is only because we repeated the calls to preinit on the client
App
javascript
facebook/react
packages/react-dom/src/__tests__/ReactDOMFloat-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactDOMFloat-test.js
MIT
function App() { ReactDOM.preinitModule(); ReactDOM.preinitModule(() => {}); ReactDOM.preinitModule(''); ReactDOM.preinitModule('1', true); ReactDOM.preinitModule('2', {as: true}); return <div>hello</div>; }
TO HERE: The client render patches in the two missing preinit stylesheets when hydration happens Note that this is only because we repeated the calls to preinit on the client
App
javascript
facebook/react
packages/react-dom/src/__tests__/ReactDOMFloat-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactDOMFloat-test.js
MIT
function App() { ReactDOM.preload('preload', {as: 'style'}); ReactDOM.preload('with\nnewline', {as: 'style'}); return ( <html> <head /> <body> <link rel="stylesheet" href="style" precedence="style" /> <link rel="stylesheet" href="with...
TO HERE: The client render patches in the two missing preinit stylesheets when hydration happens Note that this is only because we repeated the calls to preinit on the client
App
javascript
facebook/react
packages/react-dom/src/__tests__/ReactDOMFloat-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactDOMFloat-test.js
MIT
function ClientApp() { ReactDOM.preload('preload', {as: 'style'}); ReactDOM.preload('with\nnewline', {as: 'style'}); return ( <div> <link rel="stylesheet" href={'style"][rel="stylesheet'} precedence="style" /> ...
TO HERE: The client render patches in the two missing preinit stylesheets when hydration happens Note that this is only because we repeated the calls to preinit on the client
ClientApp
javascript
facebook/react
packages/react-dom/src/__tests__/ReactDOMFloat-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactDOMFloat-test.js
MIT
function App() { ReactDOM.preload('preload"][rel="preload', {as: 'style'}); ReactDOM.preinit('style"][rel="stylesheet', { as: 'style', precedence: 'style', }); ReactDOM.preinit('with\\slashes', { as: 'style', precedence: 'style', }); ...
TO HERE: The client render patches in the two missing preinit stylesheets when hydration happens Note that this is only because we repeated the calls to preinit on the client
App
javascript
facebook/react
packages/react-dom/src/__tests__/ReactDOMFloat-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactDOMFloat-test.js
MIT
function App() { return ( <html> <body> <link rel="rel1" href="linkhref" /> <link rel="rel2" href="linkhref" /> <meta name="name1" content="metacontent" /> <meta name="name2" content="metacontent" /> <Suspense fallback="...
TO HERE: The client render patches in the two missing preinit stylesheets when hydration happens Note that this is only because we repeated the calls to preinit on the client
App
javascript
facebook/react
packages/react-dom/src/__tests__/ReactDOMFloat-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactDOMFloat-test.js
MIT
valueOf() { // Throwing here is the behavior of ECMAScript "Temporal" date/time API. // See https://tc39.es/proposal-temporal/docs/plaindate.html#valueOf throw new TypeError('prod message'); }
The following Node.normalize() tests are intentionally failing. See https://github.com/facebook/react/issues/9836 tracking whether we'll need to fix this or if it's unnecessary.
valueOf
javascript
facebook/react
packages/react-dom/src/__tests__/ReactDOMTextComponent-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactDOMTextComponent-test.js
MIT
toString() { return '2020-01-01'; }
The following Node.normalize() tests are intentionally failing. See https://github.com/facebook/react/issues/9836 tracking whether we'll need to fix this or if it's unnecessary.
toString
javascript
facebook/react
packages/react-dom/src/__tests__/ReactDOMTextComponent-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactDOMTextComponent-test.js
MIT
getStatus() { return this.props.status; }
Contains internal static internal state in order to test that updates to existing children won't reinitialize components, when moving children - reusing existing DOM/memory resources.
getStatus
javascript
facebook/react
packages/react-dom/src/__tests__/ReactMultiChildReconcile-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactMultiChildReconcile-test.js
MIT
getInternalState() { return this.state.internalState; }
Contains internal static internal state in order to test that updates to existing children won't reinitialize components, when moving children - reusing existing DOM/memory resources.
getInternalState
javascript
facebook/react
packages/react-dom/src/__tests__/ReactMultiChildReconcile-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactMultiChildReconcile-test.js
MIT
render() { return <div>{this.props.contentKey}</div>; }
Contains internal static internal state in order to test that updates to existing children won't reinitialize components, when moving children - reusing existing DOM/memory resources.
render
javascript
facebook/react
packages/react-dom/src/__tests__/ReactMultiChildReconcile-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactMultiChildReconcile-test.js
MIT
getOriginalKeys() { const originalKeys = []; for (const key in this.props.usernameToStatus) { if (this.props.usernameToStatus[key]) { originalKeys.push(key); } } return originalKeys; }
Gets the order directly from each rendered child's `index` field. Refs are not maintained in the rendered order, and neither is `this._renderedChildren` (surprisingly).
getOriginalKeys
javascript
facebook/react
packages/react-dom/src/__tests__/ReactMultiChildReconcile-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactMultiChildReconcile-test.js
MIT
getStatusDisplays() { const res = {}; const originalKeys = this.getOriginalKeys(); for (let i = 0; i < originalKeys.length; i++) { const key = originalKeys[i]; res[key] = this.displays[key]; } return res; }
Retrieves the rendered children in a nice format for comparing to the input `this.props.usernameToStatus`.
getStatusDisplays
javascript
facebook/react
packages/react-dom/src/__tests__/ReactMultiChildReconcile-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactMultiChildReconcile-test.js
MIT
verifyPreviousRefsResolved(flushedKey) { const originalKeys = this.getOriginalKeys(); for (let i = 0; i < originalKeys.length; i++) { const key = originalKeys[i]; if (key === flushedKey) { // We are only interested in children up to the current key. return; } expect(this....
Verifies that by the time a child is flushed, the refs that appeared earlier have already been resolved. TODO: This assumption will likely break with incremental reconciler but our internal layer API depends on this assumption. We need to change it to be more declarative before making ref resolution indeterministic.
verifyPreviousRefsResolved
javascript
facebook/react
packages/react-dom/src/__tests__/ReactMultiChildReconcile-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactMultiChildReconcile-test.js
MIT
render() { const children = []; for (const key in this.props.usernameToStatus) { const status = this.props.usernameToStatus[key]; children.push( !status ? null : ( <StatusDisplay key={key} ref={current => { this.displays[key] = current; ...
Verifies that by the time a child is flushed, the refs that appeared earlier have already been resolved. TODO: This assumption will likely break with incremental reconciler but our internal layer API depends on this assumption. We need to change it to be more declarative before making ref resolution indeterministic.
render
javascript
facebook/react
packages/react-dom/src/__tests__/ReactMultiChildReconcile-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactMultiChildReconcile-test.js
MIT
function getInternalStateByUserName(statusDisplays) { return Object.keys(statusDisplays).reduce((acc, key) => { acc[key] = statusDisplays[key].getInternalState(); return acc; }, {}); }
Verifies that by the time a child is flushed, the refs that appeared earlier have already been resolved. TODO: This assumption will likely break with incremental reconciler but our internal layer API depends on this assumption. We need to change it to be more declarative before making ref resolution indeterministic.
getInternalStateByUserName
javascript
facebook/react
packages/react-dom/src/__tests__/ReactMultiChildReconcile-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactMultiChildReconcile-test.js
MIT
function verifyStatuses(statusDisplays, props) { const nonEmptyStatusDisplays = stripEmptyValues(statusDisplays); const nonEmptyStatusProps = stripEmptyValues(props.usernameToStatus); let username; expect(Object.keys(nonEmptyStatusDisplays).length).toEqual( Object.keys(nonEmptyStatusProps).length, ); fo...
Verifies that the rendered `StatusDisplay` instances match the `props` that were responsible for allocating them. Checks the content of the user's status message as well as the order of them.
verifyStatuses
javascript
facebook/react
packages/react-dom/src/__tests__/ReactMultiChildReconcile-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactMultiChildReconcile-test.js
MIT
function verifyStatesPreserved(lastInternalStates, statusDisplays) { let key; for (key in statusDisplays) { if (!statusDisplays.hasOwnProperty(key)) { continue; } if (lastInternalStates[key]) { expect(lastInternalStates[key]).toEqual( statusDisplays[key].getInternalState(), ); ...
For all statusDisplays that existed in the previous iteration of the sequence, verify that the state has been preserved. `StatusDisplay` contains a unique number that allows us to track internal state across ordering movements.
verifyStatesPreserved
javascript
facebook/react
packages/react-dom/src/__tests__/ReactMultiChildReconcile-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactMultiChildReconcile-test.js
MIT
function verifyDomOrderingAccurate(outerContainer, statusDisplays) { const containerNode = outerContainer.firstChild; const statusDisplayNodes = containerNode.childNodes; const orderedDomKeys = []; for (let i = 0; i < statusDisplayNodes.length; i++) { const contentKey = statusDisplayNodes[i].textContent; ...
Verifies that the internal representation of a set of `renderedChildren` accurately reflects what is in the DOM.
verifyDomOrderingAccurate
javascript
facebook/react
packages/react-dom/src/__tests__/ReactMultiChildReconcile-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactMultiChildReconcile-test.js
MIT
async function testPropsSequenceWithPreparedChildren( sequence, prepareChildren, ) { const container = document.createElement('div'); const root = ReactDOMClient.createRoot(container); let parentInstance; await act(() => { root.render( <FriendsStatusDisplay {...sequence[0]} prepare...
Verifies that the internal representation of a set of `renderedChildren` accurately reflects what is in the DOM.
testPropsSequenceWithPreparedChildren
javascript
facebook/react
packages/react-dom/src/__tests__/ReactMultiChildReconcile-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactMultiChildReconcile-test.js
MIT
function prepareChildrenArray(childrenArray) { return childrenArray; }
Verifies that the internal representation of a set of `renderedChildren` accurately reflects what is in the DOM.
prepareChildrenArray
javascript
facebook/react
packages/react-dom/src/__tests__/ReactMultiChildReconcile-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactMultiChildReconcile-test.js
MIT
function prepareChildrenLegacyIterable(childrenArray) { return { '@@iterator': function* () { // eslint-disable-next-line no-for-of-loops/no-for-of-loops for (const child of childrenArray) { yield child; } }, }; }
Verifies that the internal representation of a set of `renderedChildren` accurately reflects what is in the DOM.
prepareChildrenLegacyIterable
javascript
facebook/react
packages/react-dom/src/__tests__/ReactMultiChildReconcile-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactMultiChildReconcile-test.js
MIT
function prepareChildrenModernIterable(childrenArray) { return { [Symbol.iterator]: function* () { // eslint-disable-next-line no-for-of-loops/no-for-of-loops for (const child of childrenArray) { yield child; } }, }; }
Verifies that the internal representation of a set of `renderedChildren` accurately reflects what is in the DOM.
prepareChildrenModernIterable
javascript
facebook/react
packages/react-dom/src/__tests__/ReactMultiChildReconcile-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactMultiChildReconcile-test.js
MIT
async function testPropsSequence(sequence) { await testPropsSequenceWithPreparedChildren(sequence, prepareChildrenArray); await testPropsSequenceWithPreparedChildren( sequence, prepareChildrenLegacyIterable, ); await testPropsSequenceWithPreparedChildren( sequence, prepareChildrenModernIterable,...
Verifies that the internal representation of a set of `renderedChildren` accurately reflects what is in the DOM.
testPropsSequence
javascript
facebook/react
packages/react-dom/src/__tests__/ReactMultiChildReconcile-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactMultiChildReconcile-test.js
MIT
render() { const count = this.state.count; /** * What we have here, is three divs with refs (div1/2/3), but a single * moving cursor ref `hopRef` that "hops" around the three. We'll call the * `moveRef()` function several times and make sure that the hop ref * points ...
Tests that when a ref hops around children, we can track that correctly.
render
javascript
facebook/react
packages/react-dom/src/__tests__/refs-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/refs-test.js
MIT
render() { return <div />; }
Make sure that after the third, we're back to where we started and the refs are completely restored.
render
javascript
facebook/react
packages/react-dom/src/__tests__/refs-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/refs-test.js
MIT
function Inner(props) { return <a ref={props.saveA} />; }
Make sure that after the third, we're back to where we started and the refs are completely restored.
Inner
javascript
facebook/react
packages/react-dom/src/__tests__/refs-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/refs-test.js
MIT
render() { return <Inner saveA={this.saveA} />; }
Make sure that after the third, we're back to where we started and the refs are completely restored.
render
javascript
facebook/react
packages/react-dom/src/__tests__/refs-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/refs-test.js
MIT
method() { return true; }
Make sure that after the third, we're back to where we started and the refs are completely restored.
method
javascript
facebook/react
packages/react-dom/src/__tests__/refs-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/refs-test.js
MIT
render() { return <div>Comp</div>; }
Make sure that after the third, we're back to where we started and the refs are completely restored.
render
javascript
facebook/react
packages/react-dom/src/__tests__/refs-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/refs-test.js
MIT
function _onRefChange(_ref) { setup(_ref); return cleanUp; }
Make sure that after the third, we're back to where we started and the refs are completely restored.
_onRefChange
javascript
facebook/react
packages/react-dom/src/__tests__/refs-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/refs-test.js
MIT
function _onRefChangeWithCleanup(_ref) { if (_ref) { setup(_ref.id); } else { nullHandler(); } return cleanUp; }
Make sure that after the third, we're back to where we started and the refs are completely restored.
_onRefChangeWithCleanup
javascript
facebook/react
packages/react-dom/src/__tests__/refs-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/refs-test.js
MIT
function _onRefChangeWithoutCleanup(_ref) { if (_ref) { setup2(_ref.id); } else { nullHandler(); } }
Make sure that after the third, we're back to where we started and the refs are completely restored.
_onRefChangeWithoutCleanup
javascript
facebook/react
packages/react-dom/src/__tests__/refs-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/refs-test.js
MIT
function _onRefChangeWithCleanup(_ref) { if (_ref) { setup(_ref.id); } else { nullHandler(); } return cleanUp; }
Make sure that after the third, we're back to where we started and the refs are completely restored.
_onRefChangeWithCleanup
javascript
facebook/react
packages/react-dom/src/__tests__/refs-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/refs-test.js
MIT
greet() { return `Hello ${name}`; }
Make sure that after the third, we're back to where we started and the refs are completely restored.
greet
javascript
facebook/react
packages/react-dom/src/__tests__/refs-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/refs-test.js
MIT
ref = r => { current = r; createCalls++; return () => { current = null; cleanupCalls++; }; }
Make sure that after the third, we're back to where we started and the refs are completely restored.
ref
javascript
facebook/react
packages/react-dom/src/__tests__/refs-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/refs-test.js
MIT
ref = r => { current = r; createCalls++; return () => { current = null; cleanupCalls++; }; }
Make sure that after the third, we're back to where we started and the refs are completely restored.
ref
javascript
facebook/react
packages/react-dom/src/__tests__/refs-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/refs-test.js
MIT
function mockIntersectionObserver() { intersectionObserverMock.callback = null; intersectionObserverMock.observedTargets = []; class IntersectionObserver { constructor() { intersectionObserverMock.callback = arguments[0]; } disconnect() { intersectionObserverMock.callback = null; i...
This is a broken polyfill. It is only intended to provide bare minimum test coverage. More meaningful tests will require the use of fixtures.
mockIntersectionObserver
javascript
facebook/react
packages/react-dom/src/__tests__/utils/IntersectionMocks.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/utils/IntersectionMocks.js
MIT
constructor() { intersectionObserverMock.callback = arguments[0]; }
This is a broken polyfill. It is only intended to provide bare minimum test coverage. More meaningful tests will require the use of fixtures.
constructor
javascript
facebook/react
packages/react-dom/src/__tests__/utils/IntersectionMocks.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/utils/IntersectionMocks.js
MIT
disconnect() { intersectionObserverMock.callback = null; intersectionObserverMock.observedTargets.splice(0); }
This is a broken polyfill. It is only intended to provide bare minimum test coverage. More meaningful tests will require the use of fixtures.
disconnect
javascript
facebook/react
packages/react-dom/src/__tests__/utils/IntersectionMocks.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/utils/IntersectionMocks.js
MIT
unobserve(target) { const index = intersectionObserverMock.observedTargets.indexOf(target); if (index >= 0) { intersectionObserverMock.observedTargets.splice(index, 1); } }
This is a broken polyfill. It is only intended to provide bare minimum test coverage. More meaningful tests will require the use of fixtures.
unobserve
javascript
facebook/react
packages/react-dom/src/__tests__/utils/IntersectionMocks.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/utils/IntersectionMocks.js
MIT
function simulateIntersection(...entries) { intersectionObserverMock.callback( entries.map(([target, rect, ratio]) => ({ boundingClientRect: { top: rect.y, left: rect.x, width: rect.width, height: rect.height, }, intersectionRatio: ratio, target, })), ...
This is a broken polyfill. It is only intended to provide bare minimum test coverage. More meaningful tests will require the use of fixtures.
simulateIntersection
javascript
facebook/react
packages/react-dom/src/__tests__/utils/IntersectionMocks.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/utils/IntersectionMocks.js
MIT
function setBoundingClientRect(target, {x, y, width, height}) { target.getBoundingClientRect = function () { return { width, height, left: x, right: x + width, top: y, bottom: y + height, }; }; }
Stub out getBoundingClientRect for the specified target. This API is required by the test selectors but it isn't implemented by jsdom.
setBoundingClientRect
javascript
facebook/react
packages/react-dom/src/__tests__/utils/IntersectionMocks.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/utils/IntersectionMocks.js
MIT
function setClientRects(target, rects) { target.getClientRects = function () { return rects.map(({x, y, width, height}) => ({ width, height, left: x, right: x + width, top: y, bottom: y + height, x, y, })); }; }
Stub out getClientRects for the specified target.
setClientRects
javascript
facebook/react
packages/react-dom/src/__tests__/utils/IntersectionMocks.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/utils/IntersectionMocks.js
MIT
function createDangerousStringForStyles(styles) { if (__DEV__) { let serialized = ''; let delimiter = ''; for (const styleName in styles) { if (!styles.hasOwnProperty(styleName)) { continue; } const value = styles[styleName]; if (value != null && typeof value !== 'boolean' ...
This creates a string that is expected to be equivalent to the style attribute generated by server-side rendering. It by-passes warnings and security checks so it's not safe to use this value for anything other than comparison. It is only used in DEV for SSR validation.
createDangerousStringForStyles
javascript
facebook/react
packages/react-dom-bindings/src/client/CSSPropertyOperations.js
https://github.com/facebook/react/blob/master/packages/react-dom-bindings/src/client/CSSPropertyOperations.js
MIT
function setValueForStyle(style, styleName, value) { const isCustomProperty = styleName.indexOf('--') === 0; if (__DEV__) { if (!isCustomProperty) { warnValidStyle(styleName, value); } } if (value == null || typeof value === 'boolean' || value === '') { if (isCustomProperty) { style.set...
This creates a string that is expected to be equivalent to the style attribute generated by server-side rendering. It by-passes warnings and security checks so it's not safe to use this value for anything other than comparison. It is only used in DEV for SSR validation.
setValueForStyle
javascript
facebook/react
packages/react-dom-bindings/src/client/CSSPropertyOperations.js
https://github.com/facebook/react/blob/master/packages/react-dom-bindings/src/client/CSSPropertyOperations.js
MIT
function setValueForStyles(node, styles, prevStyles) { if (styles != null && typeof styles !== 'object') { throw new Error( 'The `style` prop expects a mapping from style properties to values, ' + "not a string. For example, style={{marginRight: spacing + 'em'}} when " + 'using JSX.', );...
Sets the value for multiple styles on a node. If a value is specified as '' (empty string), the corresponding style property will be unset. @param {DOMElement} node @param {object} styles
setValueForStyles
javascript
facebook/react
packages/react-dom-bindings/src/client/CSSPropertyOperations.js
https://github.com/facebook/react/blob/master/packages/react-dom-bindings/src/client/CSSPropertyOperations.js
MIT
function isValueEmpty(value) { return value == null || typeof value === 'boolean' || value === ''; }
Sets the value for multiple styles on a node. If a value is specified as '' (empty string), the corresponding style property will be unset. @param {DOMElement} node @param {object} styles
isValueEmpty
javascript
facebook/react
packages/react-dom-bindings/src/client/CSSPropertyOperations.js
https://github.com/facebook/react/blob/master/packages/react-dom-bindings/src/client/CSSPropertyOperations.js
MIT
function expandShorthandMap(styles) { const expanded = {}; for (const key in styles) { const longhands = shorthandToLonghand[key] || [key]; for (let i = 0; i < longhands.length; i++) { expanded[longhands[i]] = key; } } return expanded; }
Given {color: 'red', overflow: 'hidden'} returns { color: 'color', overflowX: 'overflow', overflowY: 'overflow', }. This can be read as "the overflowY property was set by the overflow shorthand". That is, the values are the property that each was derived from.
expandShorthandMap
javascript
facebook/react
packages/react-dom-bindings/src/client/CSSPropertyOperations.js
https://github.com/facebook/react/blob/master/packages/react-dom-bindings/src/client/CSSPropertyOperations.js
MIT
function validateShorthandPropertyCollisionInDev(prevStyles, nextStyles) { if (__DEV__) { if (!nextStyles) { return; } // Compute the diff as it would happen elsewhere. const expandedUpdates = {}; if (prevStyles) { for (const key in prevStyles) { if (prevStyles.hasOwnProperty(...
When mixing shorthand and longhand property names, we warn during updates if we expect an incorrect result to occur. In particular, we warn for: Updating a shorthand property (longhand gets overwritten): {font: 'foo', fontVariant: 'bar'} -> {font: 'baz', fontVariant: 'bar'} becomes .style.font = 'baz' Removing a s...
validateShorthandPropertyCollisionInDev
javascript
facebook/react
packages/react-dom-bindings/src/client/CSSPropertyOperations.js
https://github.com/facebook/react/blob/master/packages/react-dom-bindings/src/client/CSSPropertyOperations.js
MIT
function getValueForAttribute( node: Element, name: string, expected: mixed, ): mixed { if (__DEV__) { if (!isAttributeNameSafe(name)) { return; } if (!node.hasAttribute(name)) { // shouldRemoveAttribute switch (typeof expected) { case 'function': case 'symbol': ...
Get the value for a attribute on a node. Only used in DEV for SSR validation. The third argument is used as a hint of what the expected value is. Some attributes have multiple equivalent values.
getValueForAttribute
javascript
facebook/react
packages/react-dom-bindings/src/client/DOMPropertyOperations.js
https://github.com/facebook/react/blob/master/packages/react-dom-bindings/src/client/DOMPropertyOperations.js
MIT
function getValueForAttributeOnCustomComponent( node: Element, name: string, expected: mixed, ): mixed { if (__DEV__) { if (!isAttributeNameSafe(name)) { return; } if (!node.hasAttribute(name)) { // shouldRemoveAttribute switch (typeof expected) { case 'symbol': cas...
Get the value for a attribute on a node. Only used in DEV for SSR validation. The third argument is used as a hint of what the expected value is. Some attributes have multiple equivalent values.
getValueForAttributeOnCustomComponent
javascript
facebook/react
packages/react-dom-bindings/src/client/DOMPropertyOperations.js
https://github.com/facebook/react/blob/master/packages/react-dom-bindings/src/client/DOMPropertyOperations.js
MIT
function setValueForAttribute( node: Element, name: string, value: mixed, ) { if (isAttributeNameSafe(name)) { // If the prop isn't in the special list, treat it as a simple attribute. // shouldRemoveAttribute if (value === null) { node.removeAttribute(name); return; } switch (ty...
Get the value for a attribute on a node. Only used in DEV for SSR validation. The third argument is used as a hint of what the expected value is. Some attributes have multiple equivalent values.
setValueForAttribute
javascript
facebook/react
packages/react-dom-bindings/src/client/DOMPropertyOperations.js
https://github.com/facebook/react/blob/master/packages/react-dom-bindings/src/client/DOMPropertyOperations.js
MIT
function setValueForKnownAttribute( node: Element, name: string, value: mixed, ) { if (value === null) { node.removeAttribute(name); return; } switch (typeof value) { case 'undefined': case 'function': case 'symbol': case 'boolean': { node.removeAttribute(name); return; ...
Get the value for a attribute on a node. Only used in DEV for SSR validation. The third argument is used as a hint of what the expected value is. Some attributes have multiple equivalent values.
setValueForKnownAttribute
javascript
facebook/react
packages/react-dom-bindings/src/client/DOMPropertyOperations.js
https://github.com/facebook/react/blob/master/packages/react-dom-bindings/src/client/DOMPropertyOperations.js
MIT
function setValueForNamespacedAttribute( node: Element, namespace: string, name: string, value: mixed, ) { if (value === null) { node.removeAttribute(name); return; } switch (typeof value) { case 'undefined': case 'function': case 'symbol': case 'boolean': { node.removeAttrib...
Get the value for a attribute on a node. Only used in DEV for SSR validation. The third argument is used as a hint of what the expected value is. Some attributes have multiple equivalent values.
setValueForNamespacedAttribute
javascript
facebook/react
packages/react-dom-bindings/src/client/DOMPropertyOperations.js
https://github.com/facebook/react/blob/master/packages/react-dom-bindings/src/client/DOMPropertyOperations.js
MIT
function setValueForPropertyOnCustomComponent( node: Element, name: string, value: mixed, ) { if (name[0] === 'o' && name[1] === 'n') { const useCapture = name.endsWith('Capture'); const eventName = name.slice(2, useCapture ? name.length - 7 : undefined); const prevProps = getFiberCurrentPropsFromN...
Get the value for a attribute on a node. Only used in DEV for SSR validation. The third argument is used as a hint of what the expected value is. Some attributes have multiple equivalent values.
setValueForPropertyOnCustomComponent
javascript
facebook/react
packages/react-dom-bindings/src/client/DOMPropertyOperations.js
https://github.com/facebook/react/blob/master/packages/react-dom-bindings/src/client/DOMPropertyOperations.js
MIT
function getLeafNode(node: ?(Node | Element)) { while (node && node.firstChild) { node = node.firstChild; } return node; }
Given any node return the first leaf node without children. @param {DOMElement|DOMTextNode} node @return {DOMElement|DOMTextNode}
getLeafNode
javascript
facebook/react
packages/react-dom-bindings/src/client/getNodeForCharacterOffset.js
https://github.com/facebook/react/blob/master/packages/react-dom-bindings/src/client/getNodeForCharacterOffset.js
MIT