Revert "Fix 8166 html tag validation (#8176)" (#9374)

This reverts commit 9a5f4cc0ef.
This commit is contained in:
Saq Imtiaz
2025-10-29 22:01:03 +01:00
committed by GitHub
parent 9a5f4cc0ef
commit 7898cb8446
12 changed files with 47 additions and 67 deletions

View File

@@ -26,10 +26,15 @@ Render this widget into the DOM
ElementWidget.prototype.render = function(parent,nextSibling) {
this.parentDomNode = parent;
this.computeAttributes();
// Eliminate blacklisted elements
// Neuter blacklisted elements
this.tag = this.parseTreeNode.tag;
// Sanitize tag name if needed according to Custom Web-Componenets spec
this.tag = $tw.utils.makeTagNameSafe(this.tag, "safe-" + this.tag);
if($tw.config.htmlUnsafeElements.indexOf(this.tag) !== -1) {
this.tag = "safe-" + this.tag;
}
// Restrict tag name to digits, letts and dashes
this.tag = this.tag.replace(/[^0-9a-zA-Z\-]/mg,"");
// Default to a span
this.tag = this.tag || "span";
// Adjust headings by the current base level
var headingLevel = ["h1","h2","h3","h4","h5","h6"].indexOf(this.tag);
if(headingLevel !== -1) {