Add/Fix ability to use HTML fragments #4812
Merged
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.
Issue #4811 Add/Fix ability to use HTML fragments
Description of changes:
I fixed the existing code handling the HTML fragment feature, I haven't remove the obsolete
DocumentFragment
class but this class either was never really finished or pieces were lost over time.I decided to use the exact same route as for non-fragment document, and do the required work to reconnect with the existing features.
I test it by compiling with
node ./Makefile.dryice.js
on a clean new web server and it's works.Risks
Since the feature didn't work for at least the last 4/5 years I don't think new bugs will be introduced with these changes.
Few have tried to use fragment (see issue #3518), but was face to the incomplete
DocumentFragment
class.How to use Fragment
You need to pass to the HTML mode an object with a property called
fragmentContext
and the value need to be the name of a valid DOM Element tag name (head
,body
,div
,footer
, ...) ensure it in lowercase without extra space(s).After a discussion with @andrewnester , my setup is:
If for a reason I ignore you have an error telling you
require("ace/mode/html")
returnundefined
Do something like:
If you use the no-conflic version of ace, please prefix the require with
ace.
.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.