This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 10694 - Specify window.console
Summary: Specify window.console
Status: RESOLVED FIXED
Alias: None
Product: Browser Test/Tools WG
Classification: Unclassified
Component: Console (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: ---
Assignee: Michael[tm] Smith
QA Contact: This bug has no owner yet - up for the taking
URL: http://www.whatwg.org/specs/web-apps/...
Whiteboard: whatwg-resolved
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-23 09:49 UTC by contributor
Modified: 2016-02-12 16:50 UTC (History)
18 users (show)

See Also:


Attachments
www.google.com (6 bytes, patch)
2016-02-12 11:58 UTC, mike@w3.org
Details

Description contributor 2010-09-23 09:49:49 UTC
Section: http://www.whatwg.org/specs/web-apps/current-work/#the-window-object

Comment:
Specify window.console. Without it scripts around the web break because the
author left in a console.something. Not sure which members are required; Opera
has log, warn, error, info. They should be defined to either do nothing or
show the arguments converted to DOMString and joined with a U+0020 space as a
message to the user in a UA-defined way.

Posted from: 85.227.159.236
Comment 1 Simon Pieters 2010-09-23 09:59:48 UTC
Actually Chrome doesn't convert the arguments to DOMString, so strike that part.

In Opera and Chrome window.console returns a Console object, but there's no Console interface object.

We should probably also make console available to workers.
Comment 2 Kyle Simpson 2010-09-23 14:05:54 UTC
+1 on standardizing the console object, or at least having dummy no-op versions of the API functions standard-included in the browser.

Look at the hoops we have to jump through to normalize `console` across browsers and also for browsers without it defined:  http://blog.getify.com/2010/06/console-log-in-the-wild/

It would greatly simplify web development to have `console` standardized.
Comment 3 Jason McLeod 2010-09-23 14:40:30 UTC
I would love to see this happen. I often hear "Hey J, it's not working in IE" during the build/testing.  The first thing I check is for any calls to the console that I've left behind.

I've even seen people add their own functionality to assign console functions to do-nothing functions just to get around browsers that don't support it.
Comment 4 Shelley Powers 2010-09-23 16:44:53 UTC
Disagree with having this standardized. This has nothing to do with HTML, and everything to do with web application development and JavaScript.

More importantly, saying we need this because some sloppy developer left it in a production site, and it "broke", is saying that we need to codify sloppy behavior.

This is part of debugging. Chances are, you debug in one browser. Let each browser determine what is best for debugging within its own environment. By the time cross-browser testing happens, the console statements should be removed, because testing with debugging implemented is not "true" testing.
Comment 5 Maciej Stachowiak 2010-09-23 16:53:54 UTC
We added console.log and a few related calls in Safari in part because sites broke occasionally due to a stray console.log. Realistically, a new browser would have to include the console object to achieve a competitive level of compatibility.

It would be useful to spec this, but it could plausibly go in a separate spec (perhaps in Web Apps WG) since there is almost no tie-in to other things in the HTML5 spec.
Comment 6 Ian 'Hixie' Hickson 2010-09-29 06:23:27 UTC
Yeah, this doesn't seem HTML-specific. Any takers for speccing this?
Comment 7 Edward O'Connor 2010-09-29 17:39:28 UTC
I think I'll take a stab at speccing window.console.

Maciej, you wrote:
> We added console.log and a few related calls in Safari in part because
> sites broke occasionally due to a stray console.log. Realistically, a
> new browser would have to include the console object to achieve a
> competitive level of compatibility.

I went looking for what the few related calls might be: when
window.console was originally added to WebKit[1], its error, info, log,
and warn methods were added. Since then, WebKit has added a bunch more
to its Console object[2]; do you have a sense for how much of that is
needed for interop with web content?


Ted

1. http://trac.webkit.org/changeset/27161
2. http://trac.webkit.org/browser/trunk/LayoutTests/fast/dom/Window/window-properties-expected.txt#L2171
Comment 8 Maciej Stachowiak 2010-09-29 18:05:29 UTC
(In reply to comment #7)
> I think I'll take a stab at speccing window.console.
> 
> Maciej, you wrote:
> > We added console.log and a few related calls in Safari in part because
> > sites broke occasionally due to a stray console.log. Realistically, a
> > new browser would have to include the console object to achieve a
> > competitive level of compatibility.
> 
> I went looking for what the few related calls might be: when
> window.console was originally added to WebKit[1], its error, info, log,
> and warn methods were added. Since then, WebKit has added a bunch more
> to its Console object[2]; do you have a sense for how much of that is
> needed for interop with web content?
> 
> 
> Ted
> 
> 1. http://trac.webkit.org/changeset/27161
> 2.
> http://trac.webkit.org/browser/trunk/LayoutTests/fast/dom/Window/window-properties-expected.txt#L2171

The first round was driven in part by the desire to keep sites working. Most of the subsequent additions were to enable debugging compatibility between the Web Inspector and Firebug, not for stray calls left on sites.
Comment 9 Shelley Powers 2010-09-29 18:42:47 UTC
(In reply to comment #7)
> I think I'll take a stab at speccing window.console.
> 
> Maciej, you wrote:
> > We added console.log and a few related calls in Safari in part because
> > sites broke occasionally due to a stray console.log. Realistically, a
> > new browser would have to include the console object to achieve a
> > competitive level of compatibility.
> 
> I went looking for what the few related calls might be: when
> window.console was originally added to WebKit[1], its error, info, log,
> and warn methods were added. Since then, WebKit has added a bunch more
> to its Console object[2]; do you have a sense for how much of that is
> needed for interop with web content?
> 
> 
> Ted
> 
> 1. http://trac.webkit.org/changeset/27161
> 2.
> http://trac.webkit.org/browser/trunk/LayoutTests/fast/dom/Window/window-properties-expected.txt#L2171

I'm assuming that you'll submit your spec to WebApps or another group? 

If so, since this won't be in HTML, or is considered not relevant to the HTML5 spec, can we close this bug out?
Comment 10 Edward O'Connor 2010-09-29 18:53:53 UTC
(In reply to comment #9)
> I'm assuming that you'll submit your spec to WebApps or another group? 

Most probably, yes.

> If so, since this won't be in HTML, or is considered not relevant to the HTML5
> spec, can we close this bug out?

Fine by me! Resolving as WONTFIX as the HTML WG won't be addressing this.
Comment 11 Ms2ger 2011-01-05 11:55:12 UTC
For reference:

https://github.com/sideshowbarker/console-object
Comment 12 Simon Pieters 2011-11-03 10:15:25 UTC
Moving this to webapps and reopening.
Comment 13 Ms2ger 2011-11-03 17:49:46 UTC
Mike, anything happening with your spec?
Comment 14 Michael[tm] Smith 2011-11-07 08:09:12 UTC
(In reply to comment #13)
> Mike, anything happening with your spec?

Nothing new except that we made it a deliverable of the Browser Testing and Tools WG.
Comment 15 Philip Jägenstedt 2016-02-04 06:51:37 UTC
https://console.spec.whatwg.org/
Comment 16 mike@w3.org 2016-02-12 11:58:02 UTC
Created attachment 1636 [details]
www.google.com