1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/mobile/android/chrome/content/bindings/checkbox.xml Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,75 @@ 1.4 +<?xml version="1.0"?> 1.5 + 1.6 +<!-- This Source Code Form is subject to the terms of the Mozilla Public 1.7 + - License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> 1.9 + 1.10 +<!DOCTYPE bindings [ 1.11 + <!ENTITY % checkboxDTD SYSTEM "chrome://browser/locale/checkbox.dtd"> 1.12 + %checkboxDTD; 1.13 +]> 1.14 + 1.15 +<bindings 1.16 + xmlns="http://www.mozilla.org/xbl" 1.17 + xmlns:xbl="http://www.mozilla.org/xbl" 1.18 + xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> 1.19 + 1.20 + <binding id="checkbox-radio" display="xul:box" extends="chrome://global/content/bindings/checkbox.xml#checkbox-baseline"> 1.21 + <content> 1.22 + <xul:radiogroup anonid="group" xbl:inherits="disabled"> 1.23 + <xul:radio anonid="on" class="checkbox-radio-on" label="&checkbox.yes.label;" xbl:inherits="label=onlabel"/> 1.24 + <xul:radio anonid="off" class="checkbox-radio-off" label="&checkbox.no.label;" xbl:inherits="label=offlabel"/> 1.25 + </xul:radiogroup> 1.26 + </content> 1.27 + <implementation> 1.28 + <constructor><![CDATA[ 1.29 + this.setChecked(this.checked); 1.30 + ]]></constructor> 1.31 + 1.32 + <field name="_group"> 1.33 + document.getAnonymousElementByAttribute(this, "anonid", "group"); 1.34 + </field> 1.35 + 1.36 + <field name="_on"> 1.37 + document.getAnonymousElementByAttribute(this, "anonid", "on"); 1.38 + </field> 1.39 + 1.40 + <field name="_off"> 1.41 + document.getAnonymousElementByAttribute(this, "anonid", "off"); 1.42 + </field> 1.43 + 1.44 + <property name="onlabel" 1.45 + onget="return this._on.label" 1.46 + onset="this._on.label=val"/> 1.47 + 1.48 + <property name="offlabel" 1.49 + onget="return this._off.label" 1.50 + onset="this._off.label=val"/> 1.51 + 1.52 + <method name="setChecked"> 1.53 + <parameter name="aValue"/> 1.54 + <body> 1.55 + <![CDATA[ 1.56 + var change = (aValue != this.checked); 1.57 + if (aValue) { 1.58 + this.setAttribute("checked", "true"); 1.59 + this._group.selectedItem = this._on; 1.60 + } 1.61 + else { 1.62 + this.removeAttribute("checked"); 1.63 + this._group.selectedItem = this._off; 1.64 + } 1.65 + 1.66 + if (change) { 1.67 + var event = document.createEvent("Events"); 1.68 + event.initEvent("CheckboxStateChange", true, true); 1.69 + this.dispatchEvent(event); 1.70 + } 1.71 + return aValue; 1.72 + ]]> 1.73 + </body> 1.74 + </method> 1.75 + </implementation> 1.76 + </binding> 1.77 + 1.78 +</bindings>