img-no-alt-replaced.html (1205B)
1 <!doctype html> 2 <title>Images without alt attribute or with an empty alt attribute render as replaced elements regardless of src</title> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <link rel="author" href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez"> 6 <link rel="author" href="mailto:yuzhehan@chromium.org" title="Yu Han"> 7 <link rel="author" href="https://mozilla.org" title="Mozilla"> 8 <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1196668"> 9 <link rel="help" href="https://crbug.com/753868"> 10 <link ref="help" href="https://html.spec.whatwg.org/multipage/rendering.html#images-3"> 11 <style> 12 img { 13 width: 100px; 14 height: 150px; 15 } 16 </style> 17 <img> 18 <img src="broken"> 19 <img alt=""> 20 <img alt> 21 <img src="broken" alt=""> 22 <script> 23 const t = async_test("Images without alt attribute or with an empty alt attribute render as replaced elements regardless of src"); 24 onload = t.step_func_done(function() { 25 for (const img of document.querySelectorAll("img")) { 26 assert_equals(img.offsetWidth, 100, `width: ${img.outerHTML}`); 27 assert_equals(img.offsetHeight, 150, `height: ${img.outerHTML}`); 28 } 29 }); 30 </script>