From f153fcbfc324a2ea8bb6a73e99d3b1b080dba031 Mon Sep 17 00:00:00 2001 From: Bill Keese Date: Thu, 10 Sep 2015 09:55:23 +0900 Subject: [PATCH] Leverage delite/FormWidget code to read original name/value settings from embedded . Refs ibm-js/delite#394, refs #584 too. --- Slider.js | 5 +++-- StarRating.js | 26 ++++---------------------- 2 files changed, 7 insertions(+), 24 deletions(-) diff --git a/Slider.js b/Slider.js index f82d671f4a..2db149a065 100644 --- a/Slider.js +++ b/Slider.js @@ -145,9 +145,10 @@ define([ render: register.superCall(function (sup) { return function () { - this.valueNode = this.querySelector("input") || this.ownerDocument.createElement("input"); sup.call(this); - this.appendChild(this.valueNode); + if (!this.valueNode.parentNode) { + this.appendChild(this.valueNode); + } this.handleMin.setAttribute("aria-valuemin", this.min); this.focusNode.setAttribute("aria-valuemax", this.max); this.tabStops = "handleMin,focusNode"; diff --git a/StarRating.js b/StarRating.js index 39d94bcc84..ea1e047c40 100644 --- a/StarRating.js +++ b/StarRating.js @@ -76,30 +76,12 @@ define([ postRender: function () { this.notifyCurrentValue("disabled", "max", "value", "readOnly", "allowZero"); + this.valueNode.style.display = "none"; + if (!this.valueNode.parentNode) { + this.appendChild(this.valueNode); + } }, - - /** - * Handle setting of the value from the input node, if set it should be used in place of the value attribute. - */ - _mapAttributes: dcl.superCall(function (sup) { - return function () { - var inputs = this.getElementsByTagName("INPUT"); - if (inputs.length) { - this.valueNode = inputs[0]; - this.valueNode.style.display = "none"; - if (!isNaN(parseFloat(this.valueNode.value))) { - this.setAttribute("value", this.valueNode.value); - } - } else { - this.valueNode = this.ownerDocument.createElement("input"); - this.valueNode.style.display = "none"; - this.appendChild(this.valueNode); - } - return sup.call(this); - }; - }), - /* jshint maxcomplexity: 13 */ refreshRendering: function (props) { if ("disabled" in props) {