OLD | NEW |
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 /* ***** BEGIN LICENSE BLOCK ***** | 2 /* ***** BEGIN LICENSE BLOCK ***** |
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
4 * | 4 * |
5 * The contents of this file are subject to the Mozilla Public License Version | 5 * The contents of this file are subject to the Mozilla Public License Version |
6 * 1.1 (the "License"); you may not use this file except in compliance with | 6 * 1.1 (the "License"); you may not use this file except in compliance with |
7 * the License. You may obtain a copy of the License at | 7 * the License. You may obtain a copy of the License at |
8 * http://www.mozilla.org/MPL/ | 8 * http://www.mozilla.org/MPL/ |
9 * | 9 * |
10 * Software distributed under the License is distributed on an "AS IS" basis, | 10 * Software distributed under the License is distributed on an "AS IS" basis, |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 2. Call ToInteger(pos) | 53 2. Call ToInteger(pos) |
54 3. Compute the number of characters in result(1). | 54 3. Compute the number of characters in result(1). |
55 4. If Result(2) is less than 0 or is not less than | 55 4. If Result(2) is less than 0 or is not less than |
56 Result(3), return NaN. | 56 Result(3), return NaN. |
57 5. Return a value of Number type, of positive sign, whose | 57 5. Return a value of Number type, of positive sign, whose |
58 magnitude is the Unicode encoding of one character | 58 magnitude is the Unicode encoding of one character |
59 from result 1, namely the characer at position Result | 59 from result 1, namely the characer at position Result |
60 (2), where the first character in Result(1) is | 60 (2), where the first character in Result(1) is |
61 considered to be at position 0. | 61 considered to be at position 0. |
62 | 62 |
63 Note that the charCodeAt funciton is intentionally | 63 Note that the charCodeAt function is intentionally |
64 generic; it does not require that its this value be a | 64 generic; it does not require that its this value be a |
65 String object. Therefore it can be transferred to other | 65 String object. Therefore it can be transferred to other |
66 kinds of objects for use as a method. | 66 kinds of objects for use as a method. |
67 | 67 |
68 Author: christine@netscape.com | 68 Author: christine@netscape.com |
69 Date: 2 october 1997 | 69 Date: 2 october 1997 |
70 */ | 70 */ |
71 var SECTION = "15.5.4.5-6"; | 71 var SECTION = "15.5.4.5-6"; |
72 var VERSION = "ECMA_2"; | 72 var VERSION = "ECMA_2"; |
73 startTest(); | 73 startTest(); |
(...skipping 11 matching lines...) Expand all Loading... |
85 "var obj = 1234; obj.__proto__.charCodeAt = String.prototype.charC
odeAt; var s = ''; for ( var i = 0; i < 4; i++ ) s+= String.fromCharCode( obj.ch
arCodeAt(i) ); s", | 85 "var obj = 1234; obj.__proto__.charCodeAt = String.prototype.charC
odeAt; var s = ''; for ( var i = 0; i < 4; i++ ) s+= String.fromCharCode( obj.ch
arCodeAt(i) ); s", |
86 "1234", | 86 "1234", |
87 eval("var obj = 1234; obj.__proto__.charCodeAt = String.prototype.
charCodeAt; var s = ''; for ( var i = 0; i < 4; i++ ) s+= String.fromCharCode( o
bj.charCodeAt(i) ); s") ); | 87 eval("var obj = 1234; obj.__proto__.charCodeAt = String.prototype.
charCodeAt; var s = ''; for ( var i = 0; i < 4; i++ ) s+= String.fromCharCode( o
bj.charCodeAt(i) ); s") ); |
88 | 88 |
89 new TestCase( SECTION, | 89 new TestCase( SECTION, |
90 "var obj = 'hello'; obj.__proto__.charCodeAt = String.prototype.ch
arCodeAt; var s = ''; for ( var i = 0; i < 5; i++ ) s+= String.fromCharCode( obj
.charCodeAt(i) ); s", | 90 "var obj = 'hello'; obj.__proto__.charCodeAt = String.prototype.ch
arCodeAt; var s = ''; for ( var i = 0; i < 5; i++ ) s+= String.fromCharCode( obj
.charCodeAt(i) ); s", |
91 "hello", | 91 "hello", |
92 eval("var obj = 'hello'; obj.__proto__.charCodeAt = String.prototy
pe.charCodeAt; var s = ''; for ( var i = 0; i < 5; i++ ) s+= String.fromCharCode
( obj.charCodeAt(i) ); s") ); | 92 eval("var obj = 'hello'; obj.__proto__.charCodeAt = String.prototy
pe.charCodeAt; var s = ''; for ( var i = 0; i < 5; i++ ) s+= String.fromCharCode
( obj.charCodeAt(i) ); s") ); |
93 | 93 |
94 test(); | 94 test(); |
OLD | NEW |