mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-09-22 01:08:44 +00:00
Fix 8166 html tag validation (#8176)
* wip proposal still contains commented old code - tests are missing * rename isTagNameSafe to makeTagNameSafe * remove comments * remove redundant space * add htmlCustomPrimitives to the $tw.config object * remove tag-sanitation from element.js * WIP - add html-element sanitation to the new makeTagNameSafe function, so it can be used globally * simplify sanitation logic and fix inline docs * Move top comment into inline comments
This commit is contained in:
@@ -45,10 +45,7 @@ function FramedEngine(options) {
|
||||
this.iframeDoc.body.style.padding = "0";
|
||||
this.widget.domNodes.push(this.iframeNode);
|
||||
// Construct the textarea or input node
|
||||
var tag = this.widget.editTag;
|
||||
if($tw.config.htmlUnsafeElements.indexOf(tag) !== -1) {
|
||||
tag = "input";
|
||||
}
|
||||
var tag = $tw.utils.makeTagNameSafe(this.widget.editTag,"input");
|
||||
this.domNode = this.iframeDoc.createElement(tag);
|
||||
// Set the text
|
||||
if(this.widget.editTag === "textarea") {
|
||||
@@ -197,7 +194,7 @@ FramedEngine.prototype.handleFocusEvent = function(event) {
|
||||
Handle a keydown event
|
||||
*/
|
||||
FramedEngine.prototype.handleKeydownEvent = function(event) {
|
||||
if ($tw.keyboardManager.handleKeydownEvent(event, {onlyPriority: true})) {
|
||||
if($tw.keyboardManager.handleKeydownEvent(event, {onlyPriority: true})) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,10 +19,7 @@ function SimpleEngine(options) {
|
||||
this.parentNode = options.parentNode;
|
||||
this.nextSibling = options.nextSibling;
|
||||
// Construct the textarea or input node
|
||||
var tag = this.widget.editTag;
|
||||
if($tw.config.htmlUnsafeElements.indexOf(tag) !== -1) {
|
||||
tag = "input";
|
||||
}
|
||||
var tag = $tw.utils.makeTagNameSafe(this.widget.editTag,"input");
|
||||
this.domNode = this.widget.document.createElement(tag);
|
||||
// Set the text
|
||||
if(this.widget.editTag === "textarea") {
|
||||
|
||||
Reference in New Issue
Block a user