I suspect that this is a rather novice question but have been struggling to find useful information on it.
The use of innerHTML is not permitted in an extension according to the pink warning box just above this example. https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML#Example.
Is the same true of insertAdjacentHTML? I read one stackoverflow contributor’s comment that they received a “warning” to be sure to sanitize any user input before inserting it but couldn’t tell if that meant the extension failed to pass review.
I don’t want to use jQuery in the extension but, if one were to do so, would $(element).html(string) pass the AMO review?
If neither passes review, are there alternatives? For example, if one wants to capture text in a contenteditable division and then display it as html in another division within the page–similar to what happens here as questions are typed–can it be done without innerHTML or insertAdjacentHTML? ’
I realize that each individual element can be created, text content inserted into it, and appended to a fragment and then the fragment inserted into the DOM, but that seems rather cumbersome for the above scenario.
Also, is it possible to import a document node and its descendents from a background page to a web page, apart from using innerHTML? It appears that it cannot be passed as an object because the result of JSON.stringify is empty. Is there another way?
Thank you.