-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[VarDumper] Improved dump in html #12109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
hason
commented
Oct 3, 2014
Q | A |
---|---|
Bug fix? | yes |
New feature? | yes |
BC breaks? | no |
Deprecations? | no |
Tests pass? | yes |
Fixed tickets | http://www.w3.org/TR/html5/dom.html#the-id-attribute |
License | MIT |
Doc PR | - |
/** | ||
* Creates unique id for dump. | ||
*/ | ||
protected function createDumpId() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inline (or private) would be better
@@ -23,8 +24,9 @@ class HtmlDumper extends CliDumper | |||
public static $defaultOutputStream = 'php://output'; | |||
|
|||
protected $dumpHeader; | |||
protected $dumpPrefix = '<pre id=sf-dump>'; | |||
protected $dumpPrefix = '<pre id=%id%>'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add quotes around the attribute (otherwise you need a more complex escaping)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generated id is safe, it contains only [a-z0-9-]
*/ | ||
public function dump(Data $data, $lineDumper = null) | ||
{ | ||
$this->dumpId = 'sf-dump-'.md5(mt_rand()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
md5 is necessary, mt_rand is enough
👍 |
Thank you @hason. |
This PR was merged into the 2.6-dev branch. Discussion ---------- [VarDumper] Improved dump in html | Q | A | ------------- | --- | Bug fix? | yes | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | http://www.w3.org/TR/html5/dom.html#the-id-attribute | License | MIT | Doc PR | - Commits ------- f214eda [VarDumper] Added unique id for every single dump in html
This PR was merged into the 2.6-dev branch. Discussion ---------- [VarDumper] Dynamic HTML dumper | Q | A | ------------- | --- | Bug fix? | yes | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #12109 | License | MIT | Doc PR | - This PR partially reverts #12109 because it didn't take into account that many dumps can share a single style tag. More importantly, this PR enhance dump rendering with some cute JS navigation effects: - references highlighting on hovering - moving references toggling Here is a screenshot (note the yellow background and the fact that `#2` appears after the first `@2`):  Commits ------- b799844 [VarDumper] Dynamic HTML dumper