Skip to content

Commit

Permalink
WebGLRenderer: Check if _canvas has setAttribute before calling it.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdoob authored Nov 11, 2021
1 parent 9eea8cc commit fe71b47
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/renderers/WebGLRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

Expand Down

0 comments on commit fe71b47

Please sign in to comment.