2 <script src=
"../../../resources/js-test.js"></script>
3 <script src=
"resources/currentSrcHelper.js"></script>
6 <source id=
"src" srcset=
"../../hidpi/resources/image-set-1x.png?1 1x">
7 <img id=
"simple" src=
"resources/blue_rect.jpg?1">
15 var simple
= document
.getElementById('simple');
16 var src
= document
.getElementById('src');
18 simple
.addEventListener('load', function() {
21 shouldBe('document.getElementById("simple").clientWidth', '400');
22 shouldBe('currentSrcFileName("simple")', '"image-set-1x.png?1"');
24 src
.srcset
= 'resources/image-set-4x.png 1x';
27 shouldBe('document.getElementById("simple").clientWidth', '1600');
28 shouldBe('currentSrcFileName("simple")', '"image-set-4x.png"');
30 src
.parentNode
.removeChild(src
);
33 shouldBe('document.getElementById("simple").clientWidth', '75');
34 shouldBe('currentSrcFileName("simple")', '"blue_rect.jpg?1"');
36 src
.srcset
= '../../hidpi/resources/image-set-1x.png?2 1x';
37 simple
.parentNode
.insertBefore(src
, simple
);
40 shouldBe('document.getElementById("simple").clientWidth', '400');
41 shouldBe('currentSrcFileName("simple")', '"image-set-1x.png?2"');
44 // When there is a <source>, changing the <src> should have no effect
45 simple
.src
= 'resources/blue_rect.jpg?2';
46 shouldBe('currentSrcFileName("simple")', '"image-set-1x.png?2"');