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

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: 2020-06-02T08:12:21+05:30

128 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements