mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-03-24 09:23:04 -04:00
Merge pull request #1964 from lightpanda-io/currentSrc
Add Image.currentSrc and Media.currentSrc
This commit is contained in:
@@ -29,10 +29,12 @@
|
||||
|
||||
testing.expectEqual('', img.src);
|
||||
testing.expectEqual('', img.alt);
|
||||
testing.expectEqual('', img.currentSrc);
|
||||
|
||||
img.src = 'test.png';
|
||||
// src property returns resolved absolute URL
|
||||
testing.expectEqual(testing.BASE_URL + 'element/html/test.png', img.src);
|
||||
testing.expectEqual(testing.BASE_URL + 'element/html/test.png', img.currentSrc);
|
||||
// getAttribute returns the raw attribute value
|
||||
testing.expectEqual('test.png', img.getAttribute('src'));
|
||||
|
||||
|
||||
@@ -236,9 +236,11 @@
|
||||
{
|
||||
const audio = document.createElement('audio');
|
||||
testing.expectEqual('', audio.src);
|
||||
testing.expectEqual('', audio.currentSrc);
|
||||
|
||||
audio.src = 'test.mp3';
|
||||
testing.expectEqual(testing.BASE_URL + 'element/html/test.mp3', audio.src);
|
||||
testing.expectEqual(testing.BASE_URL + 'element/html/test.mp3', audio.currentSrc);
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -150,6 +150,7 @@ pub const JsApi = struct {
|
||||
|
||||
pub const constructor = bridge.constructor(Image.constructor, .{});
|
||||
pub const src = bridge.accessor(Image.getSrc, Image.setSrc, .{});
|
||||
pub const currentSrc = bridge.accessor(Image.getSrc, null, .{});
|
||||
pub const alt = bridge.accessor(Image.getAlt, Image.setAlt, .{});
|
||||
pub const width = bridge.accessor(Image.getWidth, Image.setWidth, .{});
|
||||
pub const height = bridge.accessor(Image.getHeight, Image.setHeight, .{});
|
||||
|
||||
@@ -308,6 +308,7 @@ pub const JsApi = struct {
|
||||
pub const HAVE_ENOUGH_DATA = bridge.property(@intFromEnum(ReadyState.HAVE_ENOUGH_DATA), .{ .template = true });
|
||||
|
||||
pub const src = bridge.accessor(Media.getSrc, Media.setSrc, .{});
|
||||
pub const currentSrc = bridge.accessor(Media.getSrc, null, .{});
|
||||
pub const autoplay = bridge.accessor(Media.getAutoplay, Media.setAutoplay, .{});
|
||||
pub const controls = bridge.accessor(Media.getControls, Media.setControls, .{});
|
||||
pub const loop = bridge.accessor(Media.getLoop, Media.setLoop, .{});
|
||||
|
||||
Reference in New Issue
Block a user