Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Language for grouping methods #95

Merged
merged 10 commits into from Mar 17, 2017
29 changes: 26 additions & 3 deletions index.bs
Expand Up @@ -141,9 +141,9 @@ The following is an informative summary of the format specifiers processed by th

<h3 id="printer" aoid="Printer" nothrow>Printer(<var>logLevel</var>, <var>args</var>)</h3>

The printer operation is implementation-defined. It accepts a log level indicating severity, and a List of arguments to print (which are either JavaScript objects, of any type, or are implementation-specific representations of printable things such as a stack trace, or output produced by the <code>%o</code> and <code>%O</code> specifiers). How the implementation prints <var>args</var> is up to the implementation, but implementations should separate the objects by a space or something similar, as that has become a developer expectation.
The printer operation is implementation-defined. It accepts a log level indicating severity, and a List of arguments to print (which are either JavaScript objects, of any type, or are implementation-specific representations of printable things such as a stack trace, a <a>group</a>, or output produced by the <code>%o</code> and <code>%O</code> specifiers). How the implementation prints <var>args</var> is up to the implementation, but implementations should separate the objects by a space or something similar, as that has become a developer expectation.

By the time the printer operation is called, all format specifiers will have been taken into account, and any arguments that are meant to be consumed by format specifiers will not be present in <var>args</var>. The implementation's job is simply to print the List.
By the time the printer operation is called, all format specifiers will have been taken into account, and any arguments that are meant to be consumed by format specifiers will not be present in <var>args</var>. The implementation's job is simply to print the List. The output produced by calls to Printer should appear only within the last <a>group</a> on the appropriate <a>group stack</a> if the <a>group stack</a> is not empty, or in the elsewhere in the console otherwise.

If the console is not open when the printer operation is called,
implementations should buffer messages to show them in the future up to an
Expand Down Expand Up @@ -239,7 +239,7 @@ its \[[Prototype]] an empty object, created as if by ObjectCreate(%ObjectPrototy

<h4 id="clear" oldids="dom-console-clear" method for="console">clear()</h4>

If possible for the environment, clear the console. Otherwise, do nothing.
Empty the appropriate <a>group stack</a>, and if possible for the environment, clear the console. Otherwise, do nothing.

<h4 id="count" oldids="count-label,dom-console-count" method for="console">count(<var>label</var>)</h4>

Expand Down Expand Up @@ -287,12 +287,35 @@ Perform Logger("warn", <var>data</var>).

<h3 id="grouping">Grouping methods</h3>

A <dfn>group</dfn> is an implementation-specific, potentially-interactive view for output produced by calls to Printer, with one further level of indentation than its parent. Each {{console}} namespace object has an associated <dfn>group stack</dfn>, which is a <a>stack</a>, initially empty. Only
the last <a>group</a> in a <a>group stack</a> will host output produced by calls to Printer.

<h4 id="group" oldids="group-data,dom-console-group" method for="console">group(...<var>data</var>)</h4>

<emu-alg>
1. Let _group_ be a new <a>group</a>.
1. If _data_ is not empty, let _groupLabel_ be the result of Formatter(data). Otherwise, let _groupLabel_ be an implementation-chosen label representing a <a>group</a>.
1. Incorporate _groupLabel_ as a label for _group_.
1. Optionally, if the environment supports interactive groups, _group_ should be expanded by default.
1. Perform Printer("log", «_group_»).
1. <a spec="infra">Push</a> _group_ onto the appropriate <a>group stack</a>.
</emu-alg>

<h4 id="groupcollapsed" oldids="groupcollapsed-data,dom-console-groupcollapsed" method for="console">groupCollapsed(...<var>data</var>)</h4>

<emu-alg>
1. Let _group_ be a new <a>group</a>.
1. If _data_ is not empty, let _groupLabel_ be the result of Formatter(data). Otherwise, let _groupLabel_ be an implementation-chosen label representing a <a>group</a>.
1. Incorporate _groupLabel_ as a label for _group_.
1. Optionally, if the environment supports interactive groups, _group_ should be collapsed by default.
1. Perform Printer("log", «_group_»).
1. <a spec="infra">Push</a> _group_ onto the appropriate <a>group stack</a>.
</emu-alg>

<h4 id="groupend" oldids="dom-console-groupend" method for="console">groupEnd()</h4>

<a spec="infra">Pop</a> the last <a>group</a> from the <a>group stack</a>.

<h3 id="timing">Timing methods</h3>

<h4 id="time" oldids="time-label,dom-console-time" method for="console">time(<var>label</var>)</h4>
Expand Down