From fe71b47232accbe26a5acc2e2c5bffe74219e551 Mon Sep 17 00:00:00 2001 From: "Mr.doob" Date: Thu, 11 Nov 2021 15:58:54 +0000 Subject: [PATCH] WebGLRenderer: Check if _canvas has setAttribute before calling it. --- src/renderers/WebGLRenderer.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/renderers/WebGLRenderer.js b/src/renderers/WebGLRenderer.js index 2b7274120eefe2..b433dfacccdb17 100644 --- a/src/renderers/WebGLRenderer.js +++ b/src/renderers/WebGLRenderer.js @@ -216,10 +216,10 @@ function WebGLRenderer( parameters = {} ) { failIfMajorPerformanceCaveat: _failIfMajorPerformanceCaveat }; - _canvas.setAttribute( 'data-engine', `three.js r${REVISION}` ); + // OffscreenCanvas does not have setAttribute, see #22811 + if ( 'setAttribute' in _canvas ) _canvas.setAttribute( 'data-engine', `three.js r${REVISION}` ); // event listeners must be registered before WebGL context is created, see #12753 - _canvas.addEventListener( 'webglcontextlost', onContextLost, false ); _canvas.addEventListener( 'webglcontextrestored', onContextRestore, false );