Add support for custom elements to the button widget

print-window-tiddler
Jermolene 2015-04-21 19:29:54 +01:00
rodzic bc6713007f
commit 139496209f
1 zmienionych plików z 6 dodań i 1 usunięć

Wyświetl plik

@ -34,7 +34,11 @@ ButtonWidget.prototype.render = function(parent,nextSibling) {
this.computeAttributes();
this.execute();
// Create element
var domNode = this.document.createElement("button");
var tag = "button";
if(this.buttonTag && $tw.config.htmlUnsafeElements.indexOf(this.buttonTag) === -1) {
tag = this.buttonTag;
}
var domNode = this.document.createElement(tag);
// Assign classes
var classes = this["class"].split(" ") || [],
isPoppedUp = this.popup && this.isPoppedUp();
@ -163,6 +167,7 @@ ButtonWidget.prototype.execute = function() {
this.style = this.getAttribute("style");
this.selectedClass = this.getAttribute("selectedClass");
this.defaultSetValue = this.getAttribute("default");
this.buttonTag = this.getAttribute("tag");
// Make child widgets
this.makeChildWidgets();
};