From fd1a34860127e165babafd29f978acaddb0036f0 Mon Sep 17 00:00:00 2001 From: leoflalv <47084241+leoflalv@users.noreply.github.com> Date: Tue, 28 May 2024 17:47:47 +0200 Subject: [PATCH] add group_collapsed function executing group inside it (#3867) --- core/runtime/src/console/mod.rs | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/core/runtime/src/console/mod.rs b/core/runtime/src/console/mod.rs index 607eee6b50..8953e32228 100644 --- a/core/runtime/src/console/mod.rs +++ b/core/runtime/src/console/mod.rs @@ -218,7 +218,7 @@ impl Console { 0, ) .function( - console_method_mut(Self::group, state.clone()), + console_method_mut(Self::group_collapsed, state.clone()), js_string!("groupCollapsed"), 0, ) @@ -658,6 +658,25 @@ impl Console { Ok(JsValue::undefined()) } + /// `console.groupCollapsed(...data)` + /// + /// Adds new group collapsed with name from formatted data to stack. + /// + /// More information: + /// - [MDN documentation][mdn] + /// - [WHATWG `console` specification][spec] + /// + /// [spec]: https://console.spec.whatwg.org/#groupcollapsed + /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/API/console/groupcollapsed_static + fn group_collapsed( + _: &JsValue, + args: &[JsValue], + console: &mut Self, + context: &mut Context, + ) -> JsResult { + Console::group(&JsValue::Undefined, args, console, context) + } + /// `console.groupEnd(label)` /// /// Removes the last group from the stack.