<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Web Inspector: Ability to Copy entire CSS Rule from Styles Sidebar"
   href="https://bugs.webkit.org/show_bug.cgi?id=138812#c7">Comment # 7</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Web Inspector: Ability to Copy entire CSS Rule from Styles Sidebar"
   href="https://bugs.webkit.org/show_bug.cgi?id=138812">bug 138812</a>
              from <span class="vcard"><a class="email" href="mailto:joepeck&#64;webkit.org" title="Joseph Pecoraro &lt;joepeck&#64;webkit.org&gt;"> <span class="fn">Joseph Pecoraro</span></a>
</span></b>
        <pre>Comment on <span class=""><a href="attachment.cgi?id=254299&amp;action=diff" name="attach_254299" title="Patch">attachment 254299</a> <a href="attachment.cgi?id=254299&amp;action=edit" title="Patch">[details]</a></span>
Patch

View in context: <a href="https://bugs.webkit.org/attachment.cgi?id=254299&amp;action=review">https://bugs.webkit.org/attachment.cgi?id=254299&amp;action=review</a>

<span class="quote">&gt; Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js:108
&gt; +    this._headerElement.addEventListener(&quot;contextmenu&quot;, function(event) {</span >

Style: We would probably have a _handleContextMenuEvent method down below and here we would just have:

    this._headerElement.addEventListener(&quot;contextmenu&quot;, this._handleContextMenuEvent.bind(this));

<span class="quote">&gt; Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js:110
&gt; +        if (window.getSelection().toString().length)
&gt; +            return;</span >

What is this bail for?

<span class="quote">&gt; Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js:115
&gt; +            InspectorFrontendHost.copyText(this._generateCSSRuleString.call(this));</span >

Nit: this.foo.call(this) is no different than this.foo();

<span class="quote">&gt; Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js:293
&gt; +    _generateCSSRuleString: function() {</span >

Style: Brace on new line.

<span class="quote">&gt; Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js:301
&gt; +        function repeatText(text, numRepeats) {
&gt; +            var output = &quot;&quot;;
&gt; +
&gt; +            for (var i = 0; i &lt; numRepeats; ++i)
&gt; +                output += text;
&gt; +
&gt; +            return output;
&gt; +        }</span >

Actually, we support String.prototype.repeat. So you could just do:

    &quot;test&quot;.repeat(3)

And get:

    &quot;testtesttest&quot;

<span class="quote">&gt; Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js:312
&gt; +                for (var i = numMediaQueries - 1; i &gt;= 0; --i)
&gt; +                    styleText += repeatText(&quot;    &quot;, numMediaQueries - i - 1) + &quot;&#64;media &quot; + mediaList[i].text + &quot; {\n&quot;;</span >

I wonder if this would be a good place to adopt template strings:

    styleText += `${&quot;    &quot;.repeat(numMediaQueries - i - 1)} &#64;media ${mediaList[i].text} {\n`

But maybe I'm just getting too excited. Stick with just strings for now.

<span class="quote">&gt; Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js:325
&gt; +            if (styleText.slice(-1) !== &quot;;&quot;)
&gt; +                styleText += &quot;;&quot;;</span >

I think: !styleText.endsWith(&quot;;&quot;) is more expressive.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>