Skip to content

Commit 1777f95

Browse files
authored
platform.isAttached should return false if canvas is false-y (#11707)
* platform.isAttached should return false if canvas is false-y * change styling to conform to codeclimate linter
1 parent 7736ea3 commit 1777f95

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/helpers/helpers.dom.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ function getContainerSize(canvas: HTMLCanvasElement, width: number, height: numb
142142
let maxWidth: number, maxHeight: number;
143143

144144
if (width === undefined || height === undefined) {
145-
const container = _getParentNode(canvas);
145+
const container = canvas && _getParentNode(canvas);
146146
if (!container) {
147147
width = canvas.clientWidth;
148148
height = canvas.clientHeight;

src/platform/platform.dom.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ export default class DomPlatform extends BasePlatform {
383383
* @param {HTMLCanvasElement} canvas
384384
*/
385385
isAttached(canvas) {
386-
const container = _getParentNode(canvas);
386+
const container = canvas && _getParentNode(canvas);
387387
return !!(container && container.isConnected);
388388
}
389389
}

0 commit comments

Comments
 (0)