<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>44766</bug_id>
          
          <creation_ts>2010-08-27 08:17:14 -0700</creation_ts>
          <short_desc>Web Inspector: color-code property values in object notation.</short_desc>
          <delta_ts>2011-01-26 08:12:19 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Web Inspector (Deprecated)</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Pavel Feldman">pfeldman</reporter>
          <assigned_to name="Pavel Feldman">pfeldman</assigned_to>
          <cc>abarth</cc>
    
    <cc>bweinstein</cc>
    
    <cc>cowboy</cc>
    
    <cc>eric</cc>
    
    <cc>gianni</cc>
    
    <cc>joepeck</cc>
    
    <cc>keishi</cc>
    
    <cc>loislo</cc>
    
    <cc>mathias</cc>
    
    <cc>paulirish</cc>
    
    <cc>pfeldman</cc>
    
    <cc>pmuellr</cc>
    
    <cc>rik</cc>
    
    <cc>timothy</cc>
    
    <cc>webkit.review.bot</cc>
    
    <cc>yurys</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>270503</commentid>
    <comment_count>0</comment_count>
    <who name="Pavel Feldman">pfeldman</who>
    <bug_when>2010-08-27 08:17:14 -0700</bug_when>
    <thetext>See screenshot at http://code.google.com/p/chromium/issues/detail?id=52905. We don&apos;t color-code property values in object trees.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>270506</commentid>
    <comment_count>1</comment_count>
      <attachid>65716</attachid>
    <who name="Pavel Feldman">pfeldman</who>
    <bug_when>2010-08-27 08:24:27 -0700</bug_when>
    <thetext>Created attachment 65716
[PATCH] Proposed change.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>270516</commentid>
    <comment_count>2</comment_count>
    <who name="&quot;Cowboy&quot; Ben Alman">cowboy</who>
    <bug_when>2010-08-27 08:47:41 -0700</bug_when>
    <thetext>It&apos;s not just color-coding properties in object notation, but ensuring that values are displayed consistently (colors, surrounding quotes, etc) when either returned or logged (on their own, as an array member or object property).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>270528</commentid>
    <comment_count>3</comment_count>
    <who name="&quot;Cowboy&quot; Ben Alman">cowboy</who>
    <bug_when>2010-08-27 09:06:04 -0700</bug_when>
    <thetext>(btw thanks for addressing this so quickly)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>270529</commentid>
    <comment_count>4</comment_count>
      <attachid>65716</attachid>
    <who name="Pavel Feldman">pfeldman</who>
    <bug_when>2010-08-27 09:06:54 -0700</bug_when>
    <thetext>Comment on attachment 65716
[PATCH] Proposed change.

Clearing flags on attachment: 65716

Committed r66225: &lt;http://trac.webkit.org/changeset/66225&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>270530</commentid>
    <comment_count>5</comment_count>
    <who name="Pavel Feldman">pfeldman</who>
    <bug_when>2010-08-27 09:07:05 -0700</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>270531</commentid>
    <comment_count>6</comment_count>
    <who name="Pavel Feldman">pfeldman</who>
    <bug_when>2010-08-27 09:07:26 -0700</bug_when>
    <thetext>Here is what we do:
- We color-code as follows:
number: rgb(28, 0, 207);
string, regex: rgb(196, 26, 22);
null, undefined: rgb(128, 128, 128);
- We quote strings and, surround regexes with //
- I think we dump them consistently (individually, as array members and now with this change as properties)

What exactly do you think is missing? (I don&apos;t think we should color-code functions and booleans).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>270541</commentid>
    <comment_count>7</comment_count>
    <who name="&quot;Cowboy&quot; Ben Alman">cowboy</who>
    <bug_when>2010-08-27 09:30:35 -0700</bug_when>
    <thetext>(In reply to comment #6)

Pavel, in the console.log( &quot;true&quot;, true ), the string logged is black and unquoted, making it indistinguishable from the boolean value. Can the string value be colored and quoted there as well?

Also, have you considered a color like green for boolean values? Not that this is in any way critical, but a very quick visual distinction, like numbers, strings, undefined and null already have, could be very helpful for the most commonly logged types (which I&apos;d imagine are string, number, boolean, undefined and null).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>270545</commentid>
    <comment_count>8</comment_count>
    <who name="Pavel Feldman">pfeldman</who>
    <bug_when>2010-08-27 09:39:08 -0700</bug_when>
    <thetext>(In reply to comment #7)
&gt; (In reply to comment #6)
&gt; 
&gt; Pavel, in the console.log( &quot;true&quot;, true ), the string logged is black and unquoted, making it indistinguishable from the boolean value. Can the string value be colored and quoted there as well?
&gt; 

This is intentional (there is a special piece of code that handles it). The rationale is that console.log outputs messages for user, not a string values. In 99% of cases these are just service messages, no need to quote them - it clutters ui. As a result, console.log(&quot;Something went wrong&quot;) and evaluating something with &quot;Something went wrong&quot; string result renders differently.

&gt; Also, have you considered a color like green for boolean values? Not that this is in any way critical, but a very quick visual distinction, like numbers, strings, undefined and null already have, could be very helpful for the most commonly logged types (which I&apos;d imagine are string, number, boolean, undefined and null).

I don&apos;t have a strong opinion on this. I think color-coding null, undefined and quoting are critical. Rest is more of FireBug consistency. Too many colors clutter ui too...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>270546</commentid>
    <comment_count>9</comment_count>
    <who name="WebKit Review Bot">webkit.review.bot</who>
    <bug_when>2010-08-27 09:39:59 -0700</bug_when>
    <thetext>http://trac.webkit.org/changeset/66225 might have broken Qt Linux Release</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>270563</commentid>
    <comment_count>10</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2010-08-27 09:57:52 -0700</bug_when>
    <thetext>&gt; &gt; Pavel, in the console.log( &quot;true&quot;, true ), the string logged is black and unquoted,
&gt; &gt; making it indistinguishable from the boolean value. Can the string value be colored
&gt; &gt; and quoted there as well?
&gt; &gt; 
&gt; 
&gt; This is intentional [...]

Pavel is correct. console.log() is logging a string to the console. It uses
printf() style format, and for all extra arguments it conveniently prints
them out as objects in the console. For example note the difference between:

  js&gt; console.log(&quot;logging some objects %s %s&quot;, {a:1,b:2}, [1])
  logging some objects Object Array

  js&gt; console.log(&quot;logging some objects&quot;, {a:1,b:2}, [1])
  logging some objects (triangle) Object [1]

The first argument, when it is a string, is treated as a &quot;printf&quot; string
allowing formatting for numbers, objects, etc. As Pavel mentions the typical
use case is to just log some text. In those cases we would not want to
print out the log messages formatted as a string. However, if the user has
not provided a string as the first argument, it would not be very useful
to convert that to a string and use it as a printf formatting string, so we
just log the object nicely.

If you want different logs you could do console.info(), console.error(),
console.warn(). If you want to view the formatted version of a string you
could use %o.

  js&gt; console.log(&quot;Hello %o!&quot;, &quot;World&quot;)
  Hello &quot;World&quot;!</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>65716</attachid>
            <date>2010-08-27 08:24:27 -0700</date>
            <delta_ts>2010-08-27 09:06:54 -0700</delta_ts>
            <desc>[PATCH] Proposed change.</desc>
            <filename>color_code</filename>
            <type>text/plain</type>
            <size>1286</size>
            <attacher name="Pavel Feldman">pfeldman</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL1dlYkNvcmUvQ2hhbmdlTG9nIGIvV2ViQ29yZS9DaGFuZ2VMb2cKaW5kZXgg
NTAyMWRmMS4uOTczNzYwYyAxMDA2NDQKLS0tIGEvV2ViQ29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