Skip to content

Commit 5a681fe

Browse files
committed
Make reflection topic browser-independent
Chrome and Firefox handle `.name` function attribute differently if it comes to anonymous functions. For more details see: liammclennan#53
1 parent a68ce70 commit 5a681fe

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

topics/about_reflection.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
module("About Reflection (topics/about_reflection.js)");
22

3-
var A = function() {
4-
this.aprop = "A";
3+
function A() {
4+
this.aprop = "A";
55
};
66

7-
var B = function() {
7+
function B() {
88
this.bprop = "B";
99
};
1010

@@ -14,7 +14,7 @@ test("typeof", function() {
1414
equal(__, typeof({}), 'what is the type of an empty object?');
1515
equal(__, typeof('apple'), 'what is the type of a string?');
1616
equal(__, typeof(-5), 'what is the type of -5?');
17-
equal(__, typeof(false), 'what is the type of false?');
17+
equal(__, typeof(false), 'what is the type of false?');
1818
});
1919

2020
test("property enumeration", function() {
@@ -40,7 +40,7 @@ test("hasOwnProperty", function() {
4040
equal(__, keys.length, 'how many elements are in the keys array?');
4141
deepEqual([__, __], keys, 'what are the properties of the array?');
4242

43-
// hasOwnProperty returns true if the parameter is a property directly on the object,
43+
// hasOwnProperty returns true if the parameter is a property directly on the object,
4444
// but not if it is a property accessible via the prototype chain.
4545
var ownKeys = [];
4646
for(propertyName in b) {
@@ -56,8 +56,8 @@ test("constructor property", function () {
5656
var a = new A();
5757
var b = new B();
5858
equal(__, typeof(a.constructor), "what is the type of a's constructor?");
59-
equal(__, a.constructor.name, "what is the name of a's constructor?");
60-
equal(__, b.constructor.name, "what is the name of b's constructor?");
59+
equal(__, a.constructor.name, "what is the name of a's constructor?");
60+
equal(__, b.constructor.name, "what is the name of b's constructor?");
6161
});
6262

6363
test("eval", function() {

0 commit comments

Comments
 (0)