commit-queue@webkit.org | 6b7d2be | 2014-04-05 13:52:11 +0000 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <head> |
| 4 | <title>CSSOM-View: HTMLImageElement x and y attributes</title> |
| 5 | <link rel="author" title="Adobe" href="http://html.adobe.com/"> |
| 6 | <link rel="author" title="Alan Stearns" href="mailto:stearns@adobe.com"> |
| 7 | <link rel="reviewer" title="" href=""> |
| 8 | <link rel="help" href="http://dev.w3.org/csswg/cssom-view/#excensions-to-the-htmlimageelement-interface"> |
| 9 | <meta name="assert" content="HTMLImageElement attributes give x and y position of CSS layout box"> |
| 10 | <meta name="flags" content="dom"> |
| 11 | <script src="../resources/testharness.js"></script> |
| 12 | <script src="../resources/testharnessreport.js"></script> |
| 13 | </head> |
| 14 | <body> |
| 15 | <div id="log"></div> |
| 16 | <script type="text/javascript"> |
| 17 | |
| 18 | function testIMGAttributes(attribute_name, display_none) { |
| 19 | var element = document.createElement("img"); |
| 20 | document.body.appendChild(element); |
| 21 | element.style.setProperty("position", "absolute"); |
| 22 | element.style.setProperty("left", "10px"); |
| 23 | element.style.setProperty("top", "10px"); |
| 24 | element.style.setProperty("width", "10px"); |
| 25 | element.style.setProperty("height", "10px"); |
| 26 | if (display_none) { |
| 27 | element.style.setProperty("display", "none"); |
| 28 | } |
| 29 | var attributeValue = element[attribute_name]; |
| 30 | document.body.removeChild(element); |
| 31 | return attributeValue; |
| 32 | } |
| 33 | |
| 34 | var imgAttributes = [ |
| 35 | ["x", false, 10], |
| 36 | ["y", false, 10], |
| 37 | ["x", true, 0], |
| 38 | ["y", true, 0], |
| 39 | ]; |
| 40 | |
| 41 | imgAttributes.forEach(function(test_data) { |
| 42 | test (function() { assert_equals(testIMGAttributes(test_data[0], test_data[1]), test_data[2])}, |
| 43 | "test " + test_data[0] + " with display " + test_data[1]) |
| 44 | } |
| 45 | ); |
| 46 | </script> |
| 47 | </body> |
| 48 | </html> |