(In reply to Olli Pettay [:smaug] from comment #3) > Curious, why? :) This makes code in bug 1652481 much easiser. The preliminary API that accepts a String/DocumentFragment/Document and returns a sanitized DocumentFragment. The current prototype will just use nsTreeSanitizer as it is (and we'll iterate on sanitizer flags once we have agreement on compat questions). From looking at (assertions in nsTreeSanitizer](https://searchfox.org/mozilla-central/rev/89814940895946b48b4c04c702efd2c676ec8e7e/dom/base/nsTreeSanitizer.cpp#1285,1296), it seems that we want a _new_ DocumentFragment and can't just call Sanitize on the DocumentFragment that was passed in. Maybe there is a better/easier way to clone a DocumentFragment that I should use instead?
Bug 1653232 Comment 5 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
(In reply to Olli Pettay [:smaug] from comment #3) > Curious, why? :) This makes code in bug 1652481 much easiser. The preliminary API accepts a String/DocumentFragment/Document and returns a sanitized DocumentFragment. The current prototype will just use nsTreeSanitizer as it is (and we'll iterate on sanitizer flags once we have agreement on compat questions). From looking at [assertions in nsTreeSanitizer](https://searchfox.org/mozilla-central/rev/89814940895946b48b4c04c702efd2c676ec8e7e/dom/base/nsTreeSanitizer.cpp#1285,1296), it seems that we want a _new_ DocumentFragment and can't just call Sanitize on the DocumentFragment that was passed in. Maybe there is a better/easier way to clone a DocumentFragment that I should use instead?
(In reply to Olli Pettay [:smaug] from comment #3) > Curious, why? :) This makes code in bug 1652481 much easiser. The preliminary API accepts a String/DocumentFragment/Document and returns a sanitized DocumentFragment. The current prototype will just use nsTreeSanitizer as it is (and we'll iterate on sanitizer flags once we have agreement on compat questions). From looking at [assertions in nsTreeSanitizer](https://searchfox.org/mozilla-central/rev/89814940895946b48b4c04c702efd2c676ec8e7e/dom/base/nsTreeSanitizer.cpp#1285,1296), it seems that we want a _new_ DocumentFragment and can't just call Sanitize on the DocumentFragment that was passed in (probably due to MutationObservers and stuff?). Maybe there is a better/easier way to clone a DocumentFragment that I should use instead?