Home > Web Front-end > HTML Tutorial > Can we remove the 'getContext' attribute of HTML5 Canvas tag through script?

Can we remove the 'getContext' attribute of HTML5 Canvas tag through script?

王林
Release: 2023-09-03 19:21:02
forward
1034 people have browsed it

我们能通过脚本删除HTML5 Canvas标签的“getContext”属性吗?

It is not stated in the HTML5 specification that it is valid for scripts to delete the getContext attribute.

We can write a piece of code that removes the getContext property of HTMLCanvasElement and then in a separate statement we set it to undefined.

Delete window.HTMLCanvasElement.prototype.getContext;

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

The above is the detailed content of Can we remove the 'getContext' attribute of HTML5 Canvas tag through script?. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template