Closed
Description
window.fetch
is a great progress to make asynchronous requests, thanks for that!
I am not sure whether that's the right place for doing so, I also propose that we can parse the response as HTML content.
Something like response.html([context])
where context
is the parent node of where the nodes would be inserted. It would return Promise<DocumentFragment>
.
A polyfill of them would be:
response.html = function(context) {
return this.text().then((text) => {
var range = document.createRange();
range.selectNodeContents(context);
return range.createContextualRange(text);
};
};
Use case: having directly parsed elements to possibly manipulate their content before inserting.
What do you think?
Florent
Metadata
Metadata
Assignees
Labels
No labels