B2G/gecko/browser/devtools/styleinspector/CssRuleView.jsm
/**
   * Copy a declaration from the rule view.
   *
   * @param aEvent The event object
   */
Copy a declaration from the rule view.
@param aEvent The event object
Copy a declaration from the rule view . @param aEvent The event object
function CssRuleView_onCopyDeclaration(aEvent)
  {
    let node = this.doc.popupNode;
    if (!node) {
      return;
    }
    if (!node.classList.contains("ruleview-property") &&
        !node.classList.contains("ruleview-computed")) {
      while (node = node.parentElement) {
        if (node.classList.contains("ruleview-property") ||
            node.classList.contains("ruleview-computed")) {
          break;
        }
      }
    }
    node = node.cloneNode();
    let computedLists = node.querySelectorAll(".ruleview-computedlist");
    for (let computedList of computedLists) {
      computedList.parentNode.removeChild(computedList);
    }
    let propertyName = node.querySelector(".ruleview-propertyname").textContent;
    let propertyValue = node.querySelector(".ruleview-propertyvalue").textContent;
    let out = propertyName + ": " + propertyValue + ";";
    clipboardHelper.copyString(out, this.doc);
  }
function CssRuleView_onCopyDeclaration ( aEvent ) { let node = this . doc . popupNode ; if ( ! node ) { return ; } if ( ! node . classList . contains ( "ruleview-property" ) && ! node . classList . contains ( "ruleview-computed" ) ) { while ( node = node . parentElement ) { if ( node . classList . contains ( "ruleview-property" ) || node . classList . contains ( "ruleview-computed" ) ) { break ; } } } node = node . cloneNode ( ) ; let computedLists = node . querySelectorAll ( ".ruleview-computedlist" ) ; for ( let computedList of computedLists ) { computedList . parentNode . removeChild ( computedList ) ; } let propertyName = node . querySelector ( ".ruleview-propertyname" ) . textContent ; let propertyValue = node . querySelector ( ".ruleview-propertyvalue" ) . textContent ; let out = propertyName + ": " + propertyValue + ";" ; clipboardHelper . copyString ( out , this . doc ) ; }
Copy a declaration from the rule view.
Copy a declaration from the rule view .
// We need to strip expanded properties from the node because we use // node.textContent below, which also gets text from hidden nodes. The // simplest way to do this is to clone the node and remove them from the // clone.