From 4d34bb7b87b88c8eefa947db6b7464d3a46d3ab8 Mon Sep 17 00:00:00 2001 From: "allan%beaufour.dk" Date: Mon, 27 Mar 2006 08:40:50 +0000 Subject: [PATCH] (new file) [XForms] Expose base bindings for select widgets. Bug 323849, r=doronr+aaronr, patch by surkov@dc.baikal.ru --- .../xforms/resources/content/select-xhtml.xml | 386 ++++++++++++++++++ 1 file changed, 386 insertions(+) create mode 100644 extensions/xforms/resources/content/select-xhtml.xml diff --git a/extensions/xforms/resources/content/select-xhtml.xml b/extensions/xforms/resources/content/select-xhtml.xml new file mode 100644 index 000000000000..b3c633eb0b4c --- /dev/null +++ b/extensions/xforms/resources/content/select-xhtml.xml @@ -0,0 +1,386 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + return this.getAttribute("readonly" == "true") ? true : false; + + + if (val) { + this.setAttribute("readonly", "true"); + } else { + this.removeAttribute("readonly"); + } + + + + + + + + for (var i = this.control.childNodes.length; i > 0; i--) { + this.control.removeChild(this.control.childNodes[i-1]); + } + + + + + + + + + var item = document.createElementNS(this.XHTML_NS, "option"); + item.setAttribute("value", aValue); + + if (aLabel) { + item.appendChild(aLabel.cloneNode(true)); + } + + if (aGroup) { + aGroup.appendChild(item); + } else { + this.control.appendChild(item); + } + return item; + + + + + + + + var item = document.createElementNS(this.XHTML_NS, "optgroup"); + if (aLabel) { + item.appendChild(aLabel.cloneNode(true)); + } + if (aGroup) { + aGroup.appendChild(item); + } else { + this.control.appendChild(item); + } + return item; + + + + + + + aItem.selected = true; + + + + + + + aItem.selected = false; + + + + + + + if (aItem.selected) { + return true; + } + return false; + + + + null + + + if (!this._control) { + this._control = + document.getAnonymousElementByAttribute(this, "anonid", "control"); + } + return this._control; + + + + + + + + this.dispatchDOMUIEvent("DOMFocusIn"); + + + + this.updateInstanceData(false); + this.dispatchDOMUIEvent("DOMFocusOut"); + + + + this.updateInstanceData(true); + + + + + + + + + + + + + + + + + + return this.getAttribute("readonly") == "true" ? true : false; + + + + + + + + + + + : 'selectedIndex' property isn't implemented." + ]]> + + + + + for (var i = this.control.childNodes.length; i > 0; i--) { + this.control.removeChild(this.control.childNodes[i-1]); + } + + + + + + + + + var div = document.createElementNS(this.XHTML_NS, "div"); + var input = document.createElementNS(this.XHTML_NS, "input"); + input.setAttribute("type", "checkbox"); + input.setAttribute("value", aValue); + input.setAttribute("anonid", "wcontrol"); + if (this.readonly) + input.setAttribute("disabled", "true"); + + div.appendChild(input); + if (aLabel) + div.appendChild(aLabel.cloneNode(true)); + + if (aGroup) { + aGroup.appendChild(div); + } else { + this.control.appendChild(div); + } + return div; + + + + + + + + var mainDiv = document.createElementNS(this.XHTML_NS, "div"); + + var labelDiv = document.createElementNS(this.XHTML_NS, "div"); + if (aLabel) { + labelDiv.className = "select-choice-label"; + labelDiv.appendChild(aLabel.cloneNode(true)); + } + mainDiv.appendChild(labelDiv); + + var contentDiv = document.createElementNS(this.XHTML_NS, "div"); + contentDiv.className = "select-choice-content"; + mainDiv.appendChild(contentDiv); + + if (aGroup) { + aGroup.appendChild(mainDiv); + } else { + this.control.appendChild(mainDiv); + } + + return contentDiv; + + + + + + + aItem.firstChild.checked = true; + + + + + + + aItem.firstChild.checked = false; + + + + + + + if (aItem.firstChild.checked) + return true; + return false; + + + + null + + + if (!this._control) { + this._control = this; + } + + return this._control; + + + + + + + + if (event.originalTarget.getAttribute("anonid") == "wcontrol") + this.updateInstanceData(true); + + + + if (event.originalTarget.getAttribute("anonid") == "wcontrol") + this.updateInstanceData(false); + + + + + + + +