Can we delete the “getContext” property of HTML5 Canvas tag through script?


There is no description in HTML5 specification, which says deletion of a getContext property by the script is valid.

We can write a code in which we delete getContext property of HTMLCanvasElement and then in the separate statement we make it undefined.

Delete window.HTMLCanvasElement.prototype.getContext;

_assertSame(window.HTMLCanvasElement.prototype.getContext, undefined,
   "window.HTMLCanvasElement.prototype.getContext", "undefined");

Updated on: 02-Jun-2020

65 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements