From 2697dd54668d46a4335e91710640b9a68f1af6a9 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 31 Aug 2016 10:30:10 +0200 Subject: [PATCH] [VarDumper] Make the line clickable to toggle dumps --- src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php b/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php index 95b9c04175b20..9db50c31a3aa2 100644 --- a/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php +++ b/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php @@ -190,6 +190,8 @@ function a(e, f) { f(e.target, e); } else if ('A' == e.target.parentNode.tagName) { f(e.target.parentNode, e); + } else if (e.target.nextElementSibling && 'A' == e.target.nextElementSibling.tagName) { + f(e.target.nextElementSibling, e, true); } }); }; @@ -209,7 +211,7 @@ function isCtrlKey(e) { } } }); - a('click', function (a, e) { + a('click', function (a, e, c) { if (/\bsf-dump-toggle\b/.test(a.className)) { e.preventDefault(); if (!toggle(a, isCtrlKey(e))) { @@ -230,7 +232,8 @@ function isCtrlKey(e) { } } - if (doc.getSelection) { + if (c) { + } else if (doc.getSelection) { try { doc.getSelection().removeAllRanges(); } catch (e) {