You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to enable calling freezeDry(element), freezeDry(range), and get back a string that serialises the given Element/Range (possibly also DocumentFragment, array of elements, ...). This would be useful to enable extracting e.g. a single comment from a page, freeze-drying a selection for copy/pasting into another document, etcetera.
Most of our DOM transformations are already written to act on a given rootElement, which need not be the whole document. Hence, exposing this possibility in the API should in theory not be that hard. However, some complications will have to be considered:
Stylesheets outside the snippet influence its presentation, and will need to be inlined into the snippet; probably into per-element style="..." attributes, as <style scoped>never became anything.
Ancestor elements may influence the snippets meaning/presentation; e.g. if the element/range is within a <b> element. Furthermore, an element may only be valid inside particular parent elements; e.g. a <tr> needs to be inside a <table>. Depending on the use case, it may or may not be desirable to retain such a <b>, and to wrap such a <tr> with a <table>.
As we do not return a whole document, we cannot add a content security policy in a <meta> tag; we need to be even more sure that the output is completely clean, if the snippet ought to be usable in any html document.
Probably more...
To do: look into how browsers copy selections to the clipboard; at least Chromium seems to do some effort to inline styles and wrap elements in order to keep the selection's presentation intact.
The text was updated successfully, but these errors were encountered:
I would like to enable calling
freezeDry(element)
,freezeDry(range)
, and get back a string that serialises the given Element/Range (possibly also DocumentFragment, array of elements, ...). This would be useful to enable extracting e.g. a single comment from a page, freeze-drying a selection for copy/pasting into another document, etcetera.Most of our DOM transformations are already written to act on a given
rootElement
, which need not be the whole document. Hence, exposing this possibility in the API should in theory not be that hard. However, some complications will have to be considered:style="..."
attributes, as<style scoped>
never became anything.<b>
element. Furthermore, an element may only be valid inside particular parent elements; e.g. a<tr>
needs to be inside a<table>
. Depending on the use case, it may or may not be desirable to retain such a<b>
, and to wrap such a<tr>
with a<table>
.<meta>
tag; we need to be even more sure that the output is completely clean, if the snippet ought to be usable in any html document.To do: look into how browsers copy selections to the clipboard; at least Chromium seems to do some effort to inline styles and wrap elements in order to keep the selection's presentation intact.
The text was updated successfully, but these errors were encountered: