Skip to content
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

Support DOM elements by simply appending them to the output #29

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

movitto
Copy link

@movitto movitto commented Aug 9, 2018

Greetings! This patch facilitates the inclusion of DOM elements in the JSON data rendered with renderjson. With this one could modify the json ( for example with the 'apply' method in a library such as jsonpath) so as to contain custom DOM elements & formatting for specific items before passing the entire document to renderjson as outlined in the docs. Before this patch, the createTextNode method would result in raw html being rendered on the output DOM structure whereas now DOM elements will simply be added to it.

I've tested and verified this locally, though if this patch is unagreeable or won't work for any particular use case, let me know and we can try to devise and acceptable solution.

Thank you for your time.

This allows JSON to be manipulated so as to contain DOM elements before
being passed to renderjson. Nested DOM elements will be processed as is,
being added to the output DOM structure without modifications (previously
the call to createTextNode was resulting in raw HTML being output.
@Almenon
Copy link
Contributor

Almenon commented Nov 3, 2018

I could use this for Almenon/AREPL-vscode#73, nice PR :)

I'm suprised that just took a two line code change.

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.

2 participants