MDN wants to learn about developers like you: https://qsurvey.mozilla.com/s3/MDN-dev-survey

HTMLElement.contextMenu

这篇翻译不完整。请帮忙从英语翻译这篇文章

这是一个实验中的功能
此功能某些浏览器尚在开发中,请参考浏览器兼容性表格以得到在不同浏览器中适合使用的前缀。由于该功能对应的标准文档可能被重新修订,所以在未来版本的浏览器中该功能的语法和行为可能随之改变。

HTMLElement.contextMenu 特性指的是某一元素用contextmenu 特性所创建的右键快捷菜单。该菜单本身源于 <menu> 元素所构建。

语法

var elementContextMenu = element.contextMenu;

例子

var contextMenu = document.getElementById("element").contextMenu; 

// 修改条目1的标签
contextMenu.firstElementChild.label = "New label";

详情指南

Specification Status Comment
HTML Living Standard
HTMLElement.contextMenu
Living Standard No change
HTML 5.1
HTMLElement.contextMenu
Recommendation Initial definition

浏览器兼容性

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari
Basic support 未实现[1] ? (Yes) 未实现 未实现[1] ?
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support ? ? ? ? ? ?

[1] An experimental implementation is available via the command line option --enable-blink-features=ContextMenu. Until Chrome 52 and Opera 39 it was additionally available by enabling the Experimental Web Platform features option, but got removed from that due to a Web compatibility issue. Support for this feature is requested in Chromium bug 87553.

相关链接

文档标签和贡献者

 此页面的贡献者: 1Cr18Ni9
 最后编辑者: 1Cr18Ni9,