Using a Firefox add-on that I’m writing, I add a DIV to the BODY structure of an HTML page, using this code that works well :
if (!$("#MyDIV").length) {
$("<div id='MyDIV'><img id='MyImage' src='' /></div>").appendTo("body");
}
When using the Mozilla add-on validator to have a signed add-on, I get 3 warnings (that lead to a non validated add-on) on these lines :
“jquery-3.7.1.slim.min.js line 2 column 10190”
“jquery-3.7.1.slim.min.js line 2 column 36057”
“jquery-3.7.1.slim.min.js line 2 column 48456”
Also tried this way, that also works well :
if (!$("#MyDIV").length) {
var new_html = "<div id='MyDIV'><img id='MyImage' src='' /></div>";
var new_elem = document.createElement('div');
new_elem.innerHTML = new_html; <--
document.querySelector('body').appendChild(new_elem);
}
Here I get a warning (that lead to a non validated add-on) on the line marked above with an arrow, and also :
“jquery-3.7.1.slim.min.js line 2 column 10190”
“jquery-3.7.1.slim.min.js line 2 column 36057”
“jquery-3.7.1.slim.min.js line 2 column 48456”
How can I get rid of these problems to be able to go to the next step and have a signed add-on ?
As a note, the possible spots I use in the code that could lead to an “InnerHTML” process can be :
$(this).parent().on(...........) method
$("img#MyImage").attr(.........) method
$("div#MyDIV").css(............) method