mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-12-02 14:58:06 +00:00
sets checked class for radio widget wrapper / label (#2182)
* sets checked ckass for radio widget wrapper * added tc-radio as standard class for radio widgets * removed selectedClass again, as suggested @pmario ;-)
This commit is contained in:
committed by
Jeremy Ruston
parent
ea763d0eab
commit
f092d08358
@@ -33,12 +33,15 @@ RadioWidget.prototype.render = function(parent,nextSibling) {
|
||||
this.computeAttributes();
|
||||
// Execute our logic
|
||||
this.execute();
|
||||
var isChecked = this.getValue() === this.radioValue;
|
||||
// Create our elements
|
||||
this.labelDomNode = this.document.createElement("label");
|
||||
this.labelDomNode.setAttribute("class",this.radioClass);
|
||||
this.labelDomNode.setAttribute("class",
|
||||
"tc-radio " + this.radioClass + (isChecked ? " tc-radio-selected" : "")
|
||||
);
|
||||
this.inputDomNode = this.document.createElement("input");
|
||||
this.inputDomNode.setAttribute("type","radio");
|
||||
if(this.getValue() == this.radioValue) {
|
||||
if(isChecked) {
|
||||
this.inputDomNode.setAttribute("checked","true");
|
||||
}
|
||||
this.labelDomNode.appendChild(this.inputDomNode);
|
||||
@@ -92,10 +95,6 @@ RadioWidget.prototype.execute = function() {
|
||||
this.radioIndex = this.getAttribute("index");
|
||||
this.radioValue = this.getAttribute("value");
|
||||
this.radioClass = this.getAttribute("class","");
|
||||
if(this.radioClass !== "") {
|
||||
this.radioClass += " ";
|
||||
}
|
||||
this.radioClass += "tc-radio";
|
||||
// Make the child widgets
|
||||
this.makeChildWidgets();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user