OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | |
2 // for details. All rights reserved. Use of this source code is governed by a | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 var x = 42; | |
6 | |
7 var _x = 123; | |
8 | |
9 var myArray = ["value1"]; | |
10 | |
11 var foreignDoc = (function(){ | |
12 var doc = document.implementation.createDocument("", "root", null); | |
13 var element = doc.createElement('element'); | |
14 element.setAttribute('id', 'abc'); | |
15 doc.documentElement.appendChild(element); | |
16 return doc; | |
17 })(); | |
18 | |
19 function razzle() { | |
20 return x; | |
21 } | |
22 | |
23 function getTypeOf(o) { | |
24 return typeof(o); | |
25 } | |
26 | |
27 function varArgs() { | |
28 var args = arguments; | |
29 var sum = 0; | |
30 for (var i = 0; i < args.length; ++i) { | |
31 sum += args[i]; | |
32 } | |
33 return sum; | |
34 } | |
35 | |
36 function Foo(a) { | |
37 this.a = a; | |
38 } | |
39 | |
40 Foo.b = 38; | |
41 | |
42 Foo.prototype.bar = function() { | |
43 return this.a; | |
44 } | |
45 Foo.prototype.toString = function() { | |
46 return "I'm a Foo a=" + this.a; | |
47 } | |
48 | |
49 var container = new Object(); | |
50 container.Foo = Foo; | |
51 | |
52 function isArray(a) { | |
53 return a instanceof Array; | |
54 } | |
55 | |
56 function checkMap(m, key, value) { | |
57 if (m.hasOwnProperty(key)) | |
58 return m[key] == value; | |
59 else | |
60 return false; | |
61 } | |
62 | |
63 function invokeCallback() { | |
64 return callback(); | |
65 } | |
66 | |
67 function invokeCallbackWith11params() { | |
68 return callbackWith11params(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11); | |
69 } | |
70 | |
71 function returnElement(element) { | |
72 return element; | |
73 } | |
74 | |
75 function getElementAttribute(element, attr) { | |
76 return element.getAttribute(attr); | |
77 } | |
78 | |
79 function addClassAttributes(list) { | |
80 var result = ""; | |
81 for (var i=0; i<list.length; i++) { | |
82 result += list[i].getAttribute("class"); | |
83 } | |
84 return result; | |
85 } | |
86 | |
87 function getNewDivElement() { | |
88 return document.createElement("div"); | |
89 } | |
90 | |
91 function testJsMap(callback) { | |
92 var result = callback(); | |
93 return result['value']; | |
94 } | |
95 | |
96 function Bar() { | |
97 return "ret_value"; | |
98 } | |
99 Bar.foo = "property_value"; | |
OLD | NEW |