10000 minor #18841 [Debug] More compact HTML (c960657) · symfony/symfony@c71868d · GitHub
[go: up one dir, main page]

Skip to content

Commit c71868d

Browse files
committed
minor #18841 [Debug] More compact HTML (c960657)
This PR was merged into the 3.2-dev branch. Discussion ---------- [Debug] More compact HTML | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | This patch makes the HTML output for exception stack traces slightly more compact. This makes the stack trace a bit more readable when inspecting the HTML source, e.g. when using cURL. 1. Vendor-specific prefixes for border-radius are removed. They are not relevant [in any modern browser](http://caniuse.com/border-radius). 2. The ondblclick is now added only once and relies on event bubbling rather than being added to every `<li>` in the stack trace. 3. Single quotes are not escaped. Escaping single quotes is only required for values enclosed in single quoted HTML attributes - all our attributes are double-quoted. Commits ------- 9613b75 [Debug] More compact HTML
2 parents cf4e2e9 + 9613b75 commit c71868d

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

src/Symfony/Component/Debug/ExceptionHandler.php

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -290,21 +290,13 @@ public function getStylesheet(FlattenException $exception)
290290
.sf-reset .exception_message { margin-left: 3em; display: block; }
291291
.sf-reset .traces li { font-size:12px; padding: 2px 4px; list-style-type:decimal; margin-left:20px; }
292292
.sf-reset .block { background-color:#FFFFFF; padding:10px 28px; margin-bottom:20px;
293-
-webkit-border-bottom-right-radius: 16px;
294-
-webkit-border-bottom-left-radius: 16px;
295-
-moz-border-radius-bottomright: 16px;
296-
-moz-border-radius-bottomleft: 16px;
297293
border-bottom-right-radius: 16px;
298294
border-bottom-left-radius: 16px;
299295
border-bottom:1px solid #ccc;
300296
border-right:1px solid #ccc;
301297
border-left:1px solid #ccc;
302298
}
303299
.sf-reset .block_exception { background-color:#ddd; color: #333; padding:20px;
304-
-webkit-border-top-left-radius: 16px;
305-
-webkit-border-top-right-radius: 16px;
306-
-moz-border-radius-topleft: 16px;
307-
-moz-border-radius-topright: 16px;
308300
border-top-left-radius: 16px;
309301
border-top-right-radius: 16px;
310302
border-top:1px solid #ccc;
@@ -317,8 +309,6 @@ public function getStylesheet(FlattenException $exception)
317309
.sf-reset a:hover { background:none; color:#313131; text-decoration:underline; }
318310
.sf-reset ol { padding: 10px 0; }
319311
.sf-reset h1 { background-color:#FFFFFF; padding: 15px 28px; margin-bottom: 20px;
320-
-webkit-border-radius: 10px;
321-
-moz-border-radius: 10px;
322312
border-radius: 10px;
323313
border: 1px solid #ccc;
324314
}
@@ -343,7 +333,7 @@ private function decorate($content, $css)
343333
$css
344334
</style>
345335
</head>
346-
<body>
336+
<body ondblclick="var t = event.target; if (t.title && !t.href) { var f = t.innerHTML; t.innerHTML = t.title; t.title = f; }">
347337
$content
348338
</body>
349339
</html>
@@ -368,7 +358,7 @@ private function formatPath($path, $line)
368358
return sprintf(' in <a href="%s" title="Go to source">%s line %d</a>', $link, $file, $line);
369359
}
370360

371-
return sprintf(' in <a title="%s line %3$d" ondblclick="var f=this.innerHTML;this.innerHTML=this.title;this.title=f;">%s line %d</a>', $path, $file, $line);
361+
return sprintf(' in <a title="%s line %3$d">%s line %d</a>', $path, $file, $line);
372362
}
373363

374364
/**
@@ -409,6 +399,6 @@ private function formatArgs(array $args)
409399
*/
410400
private function escapeHtml($str)
411401
{
412-
return htmlspecialchars($str, ENT_QUOTES | ENT_SUBSTITUTE, $this->charset);
402+
return htmlspecialchars($str, ENT_COMPAT | ENT_SUBSTITUTE, $this->charset);
413403
}
414404
}

0 commit comments

Comments
 (0)
0