Skip to content
Newer
Older
100644 158 lines (133 sloc) 4.98 KB
f67e76c Initial revision
Jason Johnston authored
1 <?xml version="1.0"?>
2
3 <bindings xmlns:xbl="http://www.mozilla.org/xbl"
4 xmlns="http://www.mozilla.org/xbl"
5 xmlns:h="http://www.w3.org/1999/xhtml">
6
7 <binding id="helloworld">
8 <content><h:div style="background:#6C6; padding:.5em;">Hello World! Binding Has Been Attached! Test passed.</h:div></content>
9 </binding>
10
11 <binding id="helloworld-constructor">
12 <implementation>
13 <constructor>
14 var txt = document.createTextNode("Hello World! Binding Has Been Attached! Test passed.");
15 var cont = document.createElement("div");
16 this.style.background = "#6C6";
17 cont.appendChild(txt);
18 this.appendChild(cont);
19 </constructor>
20 </implementation>
21 </binding>
22
23 <binding id="goodbyeworld">
24 <content><h:div style="background:#F00;">The binding was attached but shouldn't have been! Test failed.</h:div></content>
25 </binding>
26
27 <binding id="fields">
28 <implementation>
29 <field name="color">'#6C6'</field>
30 <field name="message">'This text and the color are specified in default field values. Test passed.'</field>
31 <constructor>
32 this.style.backgroundColor = this.color;
33 this.firstChild.nodeValue = this.message;
34 </constructor>
35 </implementation>
36 </binding>
37
38
39
40
41 <binding id="inheritance-base">
42 <implementation>
43 <field name="inheritedText">'This text is inherited from the base binding. Test passed.'</field>
44 <field name="overriddenText"></field>
45 <field name="inheritedColor">'#6C6'</field>
46 <field name="overriddenColor">'red'</field>
47 </implementation>
48 </binding>
49 <binding id="inheritance-derived" extends="#inheritance-base">
50 <implementation>
51 <field name="overriddenText">'This text overrides another text value in the base binding. Test passed.'</field>
52 <field name="overriddenColor">'#6C6'</field>
53
54 <method name="showInherited">
55 <body>
56 this.style.backgroundColor = this.inheritedColor;
57 this.firstChild.nodeValue = this.inheritedText;
58 </body>
59 </method>
60 <method name="showOverridden">
61 <body>
62 this.style.backgroundColor = this.overriddenColor;
63 this.firstChild.nodeValue = this.overriddenText;
64 </body>
65 </method>
66 </implementation>
67 </binding>
68
69 <binding id="output">
70 <implementation>
71 <field name="lineNumber">1</field>
72 <method name="print">
73 <parameter name="value" />
74 <body>
75 var item = document.createElement("div");
76 item.appendChild(document.createTextNode(this.lineNumber++ + ". " + value));
77 this.insertBefore(item, this.firstChild.nextSibling);
78 </body>
79 </method>
80 </implementation>
81 </binding>
82
83
84 <!--
85 <binding id="theBinding">
86 <implementation>
87 <method name="someMethod">
88 <parameter name="firstParam" />
89 <parameter name="secondParam" />
90 <body><![CDATA[
91 this.output('Method someMethod() called with firstParam="' + firstParam + '", secondParam="' + secondParam + '"');
92 ]]></body>
93 </method>
94
95 <method name="turnRed">
96 <body>this.style.backgroundColor = (this.style.backgroundColor=="red") ? "" : "red";</body>
97 </method>
98
99 <method name="output">
100 <parameter name="value" />
101 <body>document.getElementById("output").print(value);</body>
102 </method>
103
104 <field name="_someProperty">null</field>
105 <property name="someProperty" onget="return this._someProperty;">
106 <setter>this._someProperty = val; document.getElementById("output").print('property has been set to "' + val + '"');</setter>
107 </property>
108
109 <constructor>
110 //this.output("Constructor called on node " + this.nodeName);
111 </constructor>
112 </implementation>
113
114 <content>
115 This is an anonymous wrapper element in the XBL.
116 <h:div inherits="forwardedattr1,xblattr=forwardedattr2">
117 <children />
118 </h:div>
119 </content>
120
121 <handlers>
122 <handler event="click" action="this.output('The click was intercepted by the XBL handler.');" />
123 <handler event="mouseover">this.output('The mouseover event was intercepted by the XBL handler.');</handler>
124 <handler event="mouseout">this.output('The mouseout event was intercepted by the XBL handler.');</handler>
125 <handler event="bindingattached">this.output('The bindingattached event was fired and handled.');</handler>
126 </handlers>
127 </binding>
128
129 <binding id="theBindingWithoutKids">
130 <content>
131 This is some anonymous child text.
132 <h:p>This is an anonymous paragraph child.</h:p>
133 </content>
134 </binding>
135
136 <binding id="content-before">
137 <handlers>
138 <handler event="bindingattached">document.getElementById('output').print('The bindingattached event was fired and handled on the newly created element.');</handler>
139 </handlers>
140 <content>[XBL Binding Attached!] <children/></content>
141 </binding>
142
143 <binding id="extension-base">
144 <implementation>
145 <method name="methodOne"><body>return "Base binding";</body></method>
146 <method name="methodTwo"><body>return "Base binding (wrong!)";</body></method>
147 </implementation>
148 </binding>
149
150 <binding id="extension" extends="#extension-base">
151 <implementation>
152 <method name="methodTwo"><body>return "Derived binding";</body></method>
153 </implementation>
154 </binding>
155 -->
156
157 </bindings>
Something went wrong with that request. Please try again.