B2G/gecko/browser/devtools/styleinspector/CssRuleView.jsm
/**
   * Copy a rule from the rule view.
   *
   * @param aEvent The event object
   */
Copy a rule from the rule view.
@param aEvent The event object
Copy a rule from the rule view . @param aEvent The event object
function CssRuleView_onCopyRule(aEvent)
  {
    let terminator;
    let node = this.doc.popupNode;
    if (!node) {
      return;
    }
    if (node.className != "ruleview-rule") {
      while (node = node.parentElement) {
        if (node.className == "ruleview-rule") {
          break;
        }
      }
    }
    node = node.cloneNode();
    let computedLists = node.querySelectorAll(".ruleview-computedlist");
    for (let computedList of computedLists) {
      computedList.parentNode.removeChild(computedList);
    }
    let autosizers = node.querySelectorAll(".autosizer");
    for (let autosizer of autosizers) {
      autosizer.parentNode.removeChild(autosizer);
    }
    let selector = node.querySelector(".ruleview-selector").textContent;
    let propertyNames = node.querySelectorAll(".ruleview-propertyname");
    let propertyValues = node.querySelectorAll(".ruleview-propertyvalue");
    if (osString == "WINNT") {
      terminator = "\r\n";
    } else {
      terminator = "\n";
    }
    let out = selector + " {" + terminator;
    for (let i = 0; i < propertyNames.length; i++) {
      let name = propertyNames[i].textContent;
      let value = propertyValues[i].textContent;
      out += "    " + name + ": " + value + ";" + terminator;
    }
    out += "}" + terminator;
    clipboardHelper.copyString(out, this.doc);
  }
function CssRuleView_onCopyRule ( aEvent ) { let terminator ; let node = this . doc . popupNode ; if ( ! node ) { return ; } if ( node . className != "ruleview-rule" ) { while ( node = node . parentElement ) { if ( node . className == "ruleview-rule" ) { break ; } } } node = node . cloneNode ( ) ; let computedLists = node . querySelectorAll ( ".ruleview-computedlist" ) ; for ( let computedList of computedLists ) { computedList . parentNode . removeChild ( computedList ) ; } let autosizers = node . querySelectorAll ( ".autosizer" ) ; for ( let autosizer of autosizers ) { autosizer . parentNode . removeChild ( autosizer ) ; } let selector = node . querySelector ( ".ruleview-selector" ) . textContent ; let propertyNames = node . querySelectorAll ( ".ruleview-propertyname" ) ; let propertyValues = node . querySelectorAll ( ".ruleview-propertyvalue" ) ; if ( osString == "WINNT" ) { terminator = "\r\n" ; } else { terminator = "\n" ; } let out = selector + " {" + terminator ; for ( let i = 0 ; i < propertyNames . length ; i ++ ) { let name = propertyNames [ i ] . textContent ; let value = propertyValues [ i ] . textContent ; out += "    " + name + ": " + value + ";" + terminator ; } out += "}" + terminator ; clipboardHelper . copyString ( out , this . doc ) ; }
Copy a rule from the rule view.
Copy a rule from the rule view .
// Format the rule