| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html> | |
| 2 <title>This tests the HTMLImageElement border property.</title> | |
| 3 <body> | |
| 4 <script src="../../resources/testharness.js"></script> | |
| 5 <script src="../../resources/testharnessreport.js"></script> | |
| 6 <script type="text/javascript"> | |
| 7 function imageBorderWidth(borderValue, style) { | |
| 8 var image = document.createElement("img"); | |
| 9 if (borderValue !== undefined) | |
| 10 image.setAttribute("border", borderValue); | |
| 11 image.setAttribute("style", style); | |
| 12 image.setAttribute("width", "0"); | |
| 13 document.body.appendChild(image); | |
| 14 var borderBoxWidth = image.offsetWidth; | |
| 15 document.body.removeChild(image); | |
| 16 return borderBoxWidth / 2; | |
| 17 } | |
| 18 | |
| 19 test(function() { | |
| 20 assert_equals(imageBorderWidth(), 0); | |
| 21 assert_equals(imageBorderWidth(null), 0); | |
| 22 assert_equals(imageBorderWidth(''), 0); | |
| 23 assert_equals(imageBorderWidth(0), 0); | |
| 24 assert_equals(imageBorderWidth('x'), 0); | |
| 25 assert_equals(imageBorderWidth(undefined, 'border-width: 20px'), 0); | |
| 26 | |
| 27 assert_equals(imageBorderWidth(null, 'border-width: 20px'), 20); | |
| 28 assert_equals(imageBorderWidth('', 'border-width: 20px'), 20); | |
| 29 assert_equals(imageBorderWidth('x', 'border-width: 20px'), 20); | |
| 30 assert_equals(imageBorderWidth(0, 'border-width: 20px'), 20); | |
| 31 | |
| 32 assert_equals(imageBorderWidth(10), 10); | |
| 33 assert_equals(imageBorderWidth(' 10'), 10); | |
| 34 assert_equals(imageBorderWidth('10 '), 10); | |
| 35 assert_equals(imageBorderWidth(' 10 '), 10); | |
| 36 assert_equals(imageBorderWidth('10q'), 10); | |
| 37 assert_equals(imageBorderWidth(' 10q'), 10); | |
| 38 assert_equals(imageBorderWidth('10q '), 10); | |
| 39 assert_equals(imageBorderWidth(' 10q '), 10); | |
| 40 }); | |
| 41 </script> | |
| 42 | |
| OLD | NEW |