B2G/gecko/browser/devtools/styleinspector/CssRuleView.jsm
/**
   * Add a context menu to the rule view.
   */
Add a context menu to the rule view.
Add a context menu to the rule view .
function CssRuleView_createContextMenu()
  {
    let popupSet = this.doc.createElement("popupset");
    this.doc.documentElement.appendChild(popupSet);
    let menu = this.doc.createElement("menupopup");
    menu.id = "rule-view-context-menu";
    this._boundMenuUpdate = this._onMenuUpdate.bind(this);
    menu.addEventListener("popupshowing", this._boundMenuUpdate);
    this._copyItem = createMenuItem(menu, {
      label: "rule.contextmenu.copyselection",
      accesskey: "rule.contextmenu.copyselection.accesskey",
      command: this._boundCopy
    });
    this._boundCopyRule = this._onCopyRule.bind(this);
    this._ruleItem = createMenuItem(menu, {
      label: "rule.contextmenu.copyrule",
      accesskey: "rule.contextmenu.copyrule.accesskey",
      command: this._boundCopyRule
    });
    this._boundCopyDeclaration = this._onCopyDeclaration.bind(this);
    this._declarationItem = createMenuItem(menu, {
      label: "rule.contextmenu.copydeclaration",
      accesskey: "rule.contextmenu.copydeclaration.accesskey",
      command: this._boundCopyDeclaration
    });
    this._boundCopyProperty = this._onCopyProperty.bind(this);
    this._propertyItem = createMenuItem(menu, {
      label: "rule.contextmenu.copyproperty",
      accesskey: "rule.contextmenu.copyproperty.accesskey",
      command: this._boundCopyProperty
    });
    this._boundCopyPropertyValue = this._onCopyPropertyValue.bind(this);
    this._propertyValueItem = createMenuItem(menu,{
      label: "rule.contextmenu.copypropertyvalue",
      accesskey: "rule.contextmenu.copypropertyvalue.accesskey",
      command: this._boundCopyPropertyValue
    });
    popupSet.appendChild(menu);
    this.element.setAttribute("context", menu.id);
    this._contextMenu = menu;
  }
function CssRuleView_createContextMenu ( ) { let popupSet = this . doc . createElement ( "popupset" ) ; this . doc . documentElement . appendChild ( popupSet ) ; let menu = this . doc . createElement ( "menupopup" ) ; menu . id = "rule-view-context-menu" ; this . _boundMenuUpdate = this . _onMenuUpdate . bind ( this ) ; menu . addEventListener ( "popupshowing" , this . _boundMenuUpdate ) ; this . _copyItem = createMenuItem ( menu , { label : "rule.contextmenu.copyselection" , accesskey : "rule.contextmenu.copyselection.accesskey" , command : this . _boundCopy } ) ; this . _boundCopyRule = this . _onCopyRule . bind ( this ) ; this . _ruleItem = createMenuItem ( menu , { label : "rule.contextmenu.copyrule" , accesskey : "rule.contextmenu.copyrule.accesskey" , command : this . _boundCopyRule } ) ; this . _boundCopyDeclaration = this . _onCopyDeclaration . bind ( this ) ; this . _declarationItem = createMenuItem ( menu , { label : "rule.contextmenu.copydeclaration" , accesskey : "rule.contextmenu.copydeclaration.accesskey" , command : this . _boundCopyDeclaration } ) ; this . _boundCopyProperty = this . _onCopyProperty . bind ( this ) ; this . _propertyItem = createMenuItem ( menu , { label : "rule.contextmenu.copyproperty" , accesskey : "rule.contextmenu.copyproperty.accesskey" , command : this . _boundCopyProperty } ) ; this . _boundCopyPropertyValue = this . _onCopyPropertyValue . bind ( this ) ; this . _propertyValueItem = createMenuItem ( menu , { label : "rule.contextmenu.copypropertyvalue" , accesskey : "rule.contextmenu.copypropertyvalue.accesskey" , command : this . _boundCopyPropertyValue } ) ; popupSet . appendChild ( menu ) ; this . element . setAttribute ( "context" , menu . id ) ; this . _contextMenu = menu ; }
Add a context menu to the rule view.
Add a context menu to the rule view .
// Copy selection // Copy rule // Copy declaration