From ffc074be54dfe7934af1dca25aca0cba6de0cd1a Mon Sep 17 00:00:00 2001 From: Rui Marinho Date: Fri, 6 Apr 2012 23:19:08 +0100 Subject: [PATCH] [Profiler] Fixed IE7 JavaScript errors --- .../Resources/views/Profiler/base_js.html.twig | 12 +++++------- .../Resources/views/Profiler/toolbar_js.html.twig | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig index 8f1d684458..d6cd784c16 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig @@ -33,7 +33,8 @@ addClass: addClass, request: request, load: function(selector, url, onSuccess, onError, options) { - var el = document.querySelector(selector); + var el = document.getElementById(selector); + if (el && el.getAttribute('data-sfurl') !== url) { request( url, @@ -54,16 +55,13 @@ var i, style, tmp = elOn.style.display, - els = document.querySelectorAll(selector); + el = document.getElementById(selector); elOn.style.display = elOff.style.display; elOff.style.display = tmp; - if (els.length) { - style = 'none' === tmp ? 'none' : 'block'; - for (i = els.length - 1; i >= 0; --i) { - els[i].style.display = style; - } + if (el) { + el.style.display = 'none' === tmp ? 'none' : 'block'; } return this; diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_js.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_js.html.twig index cbd6b58479..8ea3a538b4 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_js.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_js.html.twig @@ -3,7 +3,7 @@