Skip to content

Commit

Permalink
platform.isAttached should return false if canvas is false-y (#11707)
Browse files Browse the repository at this point in the history
* platform.isAttached should return false if canvas is false-y

* change styling to conform to codeclimate linter
  • Loading branch information
DAcodedBEAT authored Mar 11, 2024
1 parent 7736ea3 commit 1777f95
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/helpers/helpers.dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ function getContainerSize(canvas: HTMLCanvasElement, width: number, height: numb
let maxWidth: number, maxHeight: number;

if (width === undefined || height === undefined) {
const container = _getParentNode(canvas);
const container = canvas && _getParentNode(canvas);
if (!container) {
width = canvas.clientWidth;
height = canvas.clientHeight;
Expand Down
2 changes: 1 addition & 1 deletion src/platform/platform.dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ export default class DomPlatform extends BasePlatform {
* @param {HTMLCanvasElement} canvas
*/
isAttached(canvas) {
const container = _getParentNode(canvas);
const container = canvas && _getParentNode(canvas);
return !!(container && container.isConnected);
}
}

0 comments on commit 1777f95

Please sign in to comment.