| <html> |
| <head> |
| <script src="../../resources/js-test-pre.js"></script> |
| <script> |
| description("Operations on the Node prototype object should be writable, enumerable and configurable."); |
| |
| Object.getOwnPropertyNames(Node.prototype).forEach(function(property) { |
| var propertyDescriptor = Object.getOwnPropertyDescriptor(Node.prototype, property); |
| if (typeof propertyDescriptor.value !== "function" || property === "constructor") |
| return; |
| |
| [ |
| { |
| name: "writable", |
| test: function(property) { |
| var propertyValue = Node.prototype[property]; |
| Node.prototype[property] = 42; |
| if (Node.prototype[property] !== 42) |
| testFailed("Property " + property + " should be writable."); |
| Node.prototype[property] = propertyValue; |
| } |
| }, |
| { |
| name: "enumerable", |
| test: function(property) { |
| if (Object.keys(Node.prototype).indexOf(property) < 0) |
| testFailed("Property " + property + " should be enumerable."); |
| } |
| }, |
| { |
| name: "configurable", |
| test: function() { |
| var propertyValue = Node.prototype[property]; |
| delete Node.prototype[property]; |
| if (Node.prototype[property] === propertyValue) |
| testFailed("Property " + property + " should be configurable."); |
| Node.prototype[property] = propertyValue; |
| } |
| } |
| ].forEach(function(attribute) { |
| var propertyAttribute = "propertyDescriptor." + attribute.name; |
| if (eval(propertyAttribute) !== true) |
| testFailed(propertyAttribute + " for property " + property + " should be true."); |
| attribute.test(property); |
| }); |
| }); |
| </script> |
| <script src="../../resources/js-test-post.js"></script> |
| </head> |
| <body> |
| <div id="console"></div> |
| </body> |
| </html> |