Improve dump function for NodeList and DomNode #320

Merged
matthijskooijman merged 5 commits from improve-dump into master 2020-08-10 15:06:50 +00:00
matthijskooijman commented 2020-05-19 08:44:54 +00:00 (Migrated from github.com)

This makes some improvements to the dump() function that logs values to the javascript console from PHP.

In particular this improves the way that a NodeList and DomNode are dumped. For example, dump($hyphaXml->find('user')); would result in:

image

This shows the nodeList with an expandable elements list, and each DomNode in the list is shown as a native Javascript DomNode, which can be traversed interactively.

Without this PR, dumping a NodeList or DomNode would just show Object { } in the console.

This makes some improvements to the `dump()` function that logs values to the javascript console from PHP. In particular this improves the way that a `NodeList` and `DomNode` are dumped. For example, `dump($hyphaXml->find('user'));` would result in: ![image](https://user-images.githubusercontent.com/194491/82305153-91128480-99bd-11ea-9d82-5d63637ffeba.png) This shows the nodeList with an expandable elements list, and each DomNode in the list is shown as a native Javascript DomNode, which can be traversed interactively. Without this PR, dumping a `NodeList` or `DomNode` would just show `Object { }` in the console.
laurensmartina (Migrated from github.com) reviewed 2020-08-10 14:16:00 +00:00
@ -559,0 +571,4 @@
if (is_array($var) && count($var) == 0)
return '[]';
// Keys all numeric and sequential? Non-associative array
laurensmartina (Migrated from github.com) commented 2020-08-10 14:16:00 +00:00

Way nicer!

Way nicer!
laurensmartina (Migrated from github.com) approved these changes 2020-08-10 14:21:11 +00:00
laurensmartina (Migrated from github.com) left a comment

Nice improvement

Nice improvement
matthijskooijman commented 2020-08-10 15:06:45 +00:00 (Migrated from github.com)

Rebased on top of master, merging next.

Rebased on top of master, merging next.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
harmen/hypha!320
No description provided.