srcset-media-dynamic.html (881B)
1 <!doctype html> 2 <title>source element in picture handles dynamic media change correctly.</title> 3 <link rel="author" href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez"> 4 <link rel="author" href="https://mozilla.org" title="Mozilla"> 5 <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1523627"> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 <picture id="pic"> 9 <source srcset="data:,a"> 10 </picture> 11 <script> 12 let t = async_test("Dynamic media change is handled correctly"); 13 14 let pic = document.getElementById("pic"); 15 // Something that will never match. 16 pic.querySelector("source").setAttribute("media", "not all"); 17 18 let img = document.createElement("img"); 19 img.src = "data:,b"; 20 pic.appendChild(img); 21 22 onload = t.step_func_done(function() { 23 assert_equals(img.currentSrc, "data:,b"); 24 }); 25 </script>