So, after the Supersharp comment , I found out that all user-defined tagName elements or the is attribute must contain a hyphen and never have to do their own elements, so the best way to use this function is:
function isCustomElement(element){
if(element.tagName.indexOf("-") !== -1) {
return true;
}
let isAttribute = element.getAttribute("is");
if(isAttribute === null) {
return false;
}
return isAttribute.indexOf("-") !== -1;
}
Just like that.
W3C Documentation :
They contain a hyphen used for the namespace and for direct compatibility (since in the future elements will not be added to HTML, SVG or MathML with hyphenated local names).
source
share