@@ -57,6 +57,7 @@ pub const Interfaces = .{
5757 HTMLHtmlElement ,
5858 HTMLIFrameElement ,
5959 HTMLImageElement ,
60+ HTMLImageElement .Factory ,
6061 HTMLInputElement ,
6162 HTMLLIElement ,
6263 HTMLLabelElement ,
@@ -565,15 +566,6 @@ pub const HTMLImageElement = struct {
565566 pub const Self = parser .Image ;
566567 pub const prototype = * HTMLElement ;
567568 pub const subtype = .node ;
568- pub const js_name = "Image" ;
569-
570- pub fn constructor (width : ? u32 , height : ? u32 , page : * const Page ) ! * parser.Image {
571- const element = try parser .documentCreateElement (parser .documentHTMLToDocument (page .window .document ), "img" );
572- const image : * parser.Image = @ptrCast (element );
573- if (width ) | width_ | try parser .imageSetWidth (image , width_ );
574- if (height ) | height_ | try parser .imageSetHeight (image , height_ );
575- return image ;
576- }
577569
578570 pub fn get_alt (self : * parser.Image ) ! []const u8 {
579571 return try parser .imageGetAlt (self );
@@ -611,6 +603,21 @@ pub const HTMLImageElement = struct {
611603 pub fn set_isMap (self : * parser.Image , is_map : bool ) ! void {
612604 try parser .imageSetIsMap (self , is_map );
613605 }
606+
607+ pub const Factory = struct {
608+ pub const js_name = "Image" ;
609+ pub const subtype = .node ;
610+ pub const js_legacy_factory = true ;
611+ pub const prototype = * HTMLImageElement ;
612+
613+ pub fn constructor (width : ? u32 , height : ? u32 , page : * const Page ) ! * parser.Image {
614+ const element = try parser .documentCreateElement (parser .documentHTMLToDocument (page .window .document ), "img" );
615+ const image : * parser.Image = @ptrCast (element );
616+ if (width ) | width_ | try parser .imageSetWidth (image , width_ );
617+ if (height ) | height_ | try parser .imageSetHeight (image , height_ );
618+ return image ;
619+ }
620+ };
614621};
615622
616623pub const HTMLInputElement = struct {
0 commit comments