8000 [WebProfilerBundle] Fix javascript toolbar on IE8 · symfony/symfony@15e2da8 · GitHub
[go: up one dir, main page]

Skip to content

Commit 15e2da8

Browse files
committed
[WebProfilerBundle] Fix javascript toolbar on IE8
1 parent d64cb49 commit 15e2da8

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@
44
55
var noop = function() {},
66
7+
collectionToArray = function (collection) {
8+
var length = collection.length || 0,
9+
results = new Array(length);
10+
11+
while (length--) {
12+
results[length] = collection[length];
13+
}
14+
15+
return results;
16+
},
17+
718
profilerStorageKey = 'sf2/profiler/',
819
920
request = function(url, onSuccess, onError, payload, options) {
@@ -131,13 +142,13 @@
131142
}
132143
} else if (request.loading) {
133144
requestState = 'loading';
134-
state = 'loading'
145+
state = 'loading';
135146
}
136147
row.className = 'sf-ajax-request sf-ajax-request-' + requestState;
137148
}
138149
139150
var infoSpan = document.querySelectorAll(".sf-toolbar-ajax-info")[0];
140-
var children = Array.prototype.slice.call(tbody.children);
151+
var children = collectionToArray(tbody.children);
141152
for (var i = 0; i < children.length; i++) {
142153
tbody.removeChild(children[i]);
143154
}
@@ -185,7 +196,7 @@
185196
}
186197
187198
{% if excluded_ajax_paths is defined %}
188-
if (window.XMLHttpRequest) {
199+
if (window.XMLHttpRequest && XMLHttpRequest.addEventListener) {
189200
var proxied = XMLHttpRequest.prototype.open;
190201
191202
XMLHttpRequest.prototype.open = function(method, url, async, user, pass) {
@@ -262,9 +273,7 @@
262273
},
263274
264275
toggle: function(selector, elOn, elOff) {
265-
var i,
266-
style,
267-
tmp = elOn.style.display,
276+
var tmp = elOn.style.display,
268277
el = document.getElementById(selector);
269278
270279
elOn.style.display = elOff.style.display;

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_js.html.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@
3333
Sfjs.renderAjaxRequests();
3434
3535
/* Handle toolbar-info position */
36-
var toolbarBlocks = document.getElementsByClassName('sf-toolbar-block');
36+
var toolbarBlocks = document.querySelectorAll('.sf-toolbar-block');
3737
for (var i = 0; i < toolbarBlocks.length; i += 1) {
3838
toolbarBlocks[i].onmouseover = function () {
39-
var toolbarInfo = this.getElementsByClassName('sf-toolbar-info')[0];
39+
var toolbarInfo = this.querySelectorAll('.sf-toolbar-info')[0];
4040
var pageWidth = document.body.clientWidth;
4141
var elementWidth = toolbarInfo.offsetWidth;
4242
var leftValue =< 3955 /span> (elementWidth + this.offsetLeft) - pageWidth;

0 commit comments

Comments
 (0)
0