remove empty class="" from button widget to simplify DOM

This commit is contained in:
pmario 2024-04-25 18:07:59 +02:00
parent b4c369adc4
commit a53c6b5e5c
1 changed files with 4 additions and 2 deletions

View File

@ -75,7 +75,7 @@ ButtonWidget.prototype.render = function(parent,nextSibling) {
domNode = this.document.createElement(tag);
this.domNode = domNode;
// Assign classes
var classes = this["class"].split(" ") || [],
var classes = (this["class"]) ? this["class"].split(" ") : [],
isPoppedUp = (this.popup || this.popupTitle) && this.isPoppedUp();
if(this.selectedClass) {
if((this.set || this.setTitle) && this.setTo && this.isSelected()) {
@ -89,7 +89,9 @@ ButtonWidget.prototype.render = function(parent,nextSibling) {
if(isPoppedUp) {
$tw.utils.pushTop(classes,"tc-popup-handle");
}
domNode.className = classes.join(" ");
if(classes.length > 0) {
domNode.className = classes.join(" ");
}
// Assign data- attributes
this.assignAttributes(domNode,{
sourcePrefix: "data-",