53f995b74bc43228fa89d082f4c79bdf6f19eb28
[platform/framework/web/crosswalk-tizen.git] /
1 if (true) {
2   doStuff()
3 }
4
5 if (foo || bar) {
6   if (bar === 'bar') {
7     // nested
8     log('nested if');
9   } else {
10     log('nested else')
11   }
12 } else if (baz == null) {
13   // else if
14   log('elseif');
15 } else {
16   // else
17   log('else');
18   // should keep the 2 empty lines
19
20
21 }
22
23 if (singleLine) singleLine();
24
25
26 // it's a trap!
27 if (asi && noBraces)
28   dolor()
29 else
30   amet();
31
32 // another trap!
33 if (asi && noBraces2) dolor()
34 else amet();
35
36 // issue #7
37 function iss7() {
38   if (wait === true ? --jQuery.readyWait : jQuery.isReady) {
39     return;
40   }
41 }
42
43 // issue #32
44 if (foo === bar &&
45   foo > bar) {
46   foo = bar;
47 }
48 (function() {
49   if (foo === bar &&
50     //bla bla bla
51     foo > bar) {
52     foo = bar;
53   } else if (foo > bar ||
54     foo <= bar) {
55     foo = bar;
56   } else {
57     foo = bar;
58     if (foo !== bar) {
59       foo = bar;
60     } else if (foo > bar ||
61       //Hey ho
62       foo <= bar) {
63       bar = foo;
64     }
65   }
66 })();
67
68
69
70 // issue #34 (keep line comment on same line)
71 if (window.DOMParser) { // Standard
72   tmp = new DOMParser();
73   xml = tmp.parseFromString(data, "text/xml");
74 } else { // IE
75   xml = new ActiveXObject("Microsoft.XMLDOM");
76   xml.async = "false";
77   xml.loadXML(data);
78 }
79
80
81 // test with multiple lines!
82 if (
83   lorem === ipsum &&
84   dolor !== 'amet'
85 ) {
86   yeah();
87 }
88 if (
89   // comment
90   lorem === ipsum &&
91   // comment
92   dolor !== 'amet'
93 ) {
94   yeah();
95 }
96
97 // issue #163
98 if (someInt > 0 && someBool) // some comment
99 {
100   someCode();
101 }
102
103
104 // issue #161
105 function test(a) {
106   if (a.one) {
107     a.one()
108   }
109   //test
110   else if (a.two) {
111     a.two();
112   }
113 }
114
115
116 // issue #196
117 if (a) a(); // run a
118 else if (b) b(); // run b
119 else {
120   c(); // run c
121 }
122
123
124 // issue #197
125 function iss197() {
126   for (var key in pattern) {
127
128     // Ignore some node properties
129     if (foo) {
130       continue;
131     }
132
133     // Match array property
134     if (_.isArray(pattern[key])) {
135       if (!bar) {
136         return false;
137       }
138
139     // Match object property
140     } else if (dolor) {
141
142       // Special case rest params (requires knowledge of sibling nodes)
143       if (ipsum) {
144         return ipsum;
145       } else if (!amet) {
146         return false;
147       }
148
149     // Match other properties (string, boolean, null, etc.)
150     } else if (pattern[key] !== node[key]) {
151       return false;
152     }
153   }
154   return true;
155 }
156
157 // issue #222
158 var obj;
159 if (
160   delete obj.hello
161   , 'world') {
162   // more code
163 }
164
165 // issue #297
166 if (foo) {
167   bar()
168
169   // this comment should be indented
170
171   baz();
172 }