Support DOM elements by simply appending them to the output#29
Open
movitto wants to merge 1 commit intocaldwell:masterfrom
Open
Support DOM elements by simply appending them to the output#29movitto wants to merge 1 commit intocaldwell:masterfrom
movitto wants to merge 1 commit intocaldwell:masterfrom
Conversation
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.
Contributor
|
I could use this for Almenon/AREPL-vscode#73, nice PR :) I'm suprised that just took a two line code change. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.