| 1 |
// Copyright (c) 2012 Ecma International. All rights reserved. |
| 2 |
// This code is governed by the BSD license found in the LICENSE file. |
| 3 |
|
| 4 |
/*--- |
| 5 |
es5id: 15.2.3.5-4-39 |
| 6 |
description: > |
| 7 |
Object.create - ensure that side-effects of gets occur in the same |
| 8 |
order as they would for: for (P in props) props[P] (15.2.3.7 step |
| 9 |
5.a) |
| 10 |
---*/ |
| 11 |
|
| 12 |
var props = {}; |
| 13 |
props.prop1 = { |
| 14 |
value: 12, |
| 15 |
enumerable: true |
| 16 |
}; |
| 17 |
props.prop2 = { |
| 18 |
value: true, |
| 19 |
enumerable: true |
| 20 |
}; |
| 21 |
|
| 22 |
var tempArray = []; |
| 23 |
for (var p in props) { |
| 24 |
if (props.hasOwnProperty(p)) { |
| 25 |
tempArray.push(p); |
| 26 |
} |
| 27 |
} |
| 28 |
|
| 29 |
var newObj = Object.create({}, props); |
| 30 |
var index = 0; |
| 31 |
for (var q in newObj) { |
| 32 |
assert.sameValue(tempArray[index++] !== q && newObj.hasOwnProperty(q), false, 'tempArray[index++] !== q && newObj.hasOwnProperty(q)'); |
| 33 |
} |