Skip to content

[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

Merged
merged 1 commit into from
Oct 3, 2014

Conversation

hason
Copy link
Contributor

@hason 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()
Copy link
Member

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%>';
Copy link
Member

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)

Copy link
Contributor Author

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-]

@hason hason changed the title [VarDumper] Added unique id for every single dump in html [VarDumper] Improved dump in html Oct 3, 2014
*/
public function dump(Data $data, $lineDumper = null)
{
$this->dumpId = 'sf-dump-'.md5(mt_rand());
Copy link
Member

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

@nicolas-grekas
Copy link
Member

👍

@fabpot
Copy link
Member

fabpot commented Oct 3, 2014

Thank you @hason.

@fabpot fabpot merged commit f214eda into symfony:master Oct 3, 2014
fabpot added a commit that referenced this pull request Oct 3, 2014
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
@hason hason deleted the vardump-id branch October 3, 2014 12:47
fabpot added a commit that referenced this pull request Oct 5, 2014
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`):
![capture du 2014-10-04 09 45 44](https://cloud.githubusercontent.com/assets/243674/4514936/4431c67e-4b9b-11e4-9809-8d06836be824.png)

Commits
-------

b799844 [VarDumper] Dynamic HTML dumper
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants