Skip to content

Commit ab33d08

Browse files
authored
Get rid of inline styles in widgets.js resulting in csp errors (php-debugbar#564)
1 parent aafb756 commit ab33d08

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/DebugBar/Resources/widgets.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,3 +263,9 @@ div.phpdebugbar-widgets-exceptions a.phpdebugbar-widgets-editor-link:before {
263263
content: "\f08e";
264264
margin-left: 4px;
265265
}
266+
267+
ul.phpdebugbar-widgets-timeline table.phpdebugbar-widgets-params {
268+
display: table;
269+
border: 0;
270+
width: 99%;
271+
}

src/DebugBar/Resources/widgets.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,15 +514,16 @@ if (typeof(PhpDebugBar) == 'undefined') {
514514
});
515515

516516
// build table and add
517-
var aggregateTable = $('<table style="display: table; border: 0; width: 99%"></table>').addClass(csscls('params'));
517+
var aggregateTable = $('<table></table>').addClass(csscls('params'));
518518
$.each(aggregate, function(i, aggregate) {
519519
width = Math.min((aggregate.data.duration * 100 / data.duration).toFixed(2), 100);
520520

521521
aggregateTable.append('<tr><td class="' + csscls('name') + '">' + aggregate.data.count + ' x ' + aggregate.label + ' (' + width + '%)</td><td class="' + csscls('value') + '">' +
522522
'<div class="' + csscls('measure') +'">' +
523-
'<span class="' + csscls('value') + '" style="width:' + width + '%"></span>' +
523+
'<span class="' + csscls('value') + '"></span>' +
524524
'<span class="' + csscls('label') + '">' + formatDuration(aggregate.data.duration) + (aggregate.data.memory ? '/' + formatBytes(aggregate.data.memory) : '') + '</span>' +
525525
'</div></td></tr>');
526+
aggregateTable.find('span.' + csscls('value') + ':last').css({width: width + "%" });
526527
});
527528

528529
this.$el.append('<li/>').find('li:last').append(aggregateTable);

0 commit comments

Comments
 (0)