iframe.contentWindow

This commit is contained in:
Karl Seguin
2025-11-20 21:46:28 +08:00
parent ce351afb9a
commit 57aa267f24
2 changed files with 14 additions and 0 deletions

View File

@@ -1134,6 +1134,12 @@ pub fn createElement(self: *Page, ns_: ?[]const u8, name: []const u8, attribute_
attribute_iterator,
.{ ._proto = undefined },
),
asUint("iframe") => return self.createHtmlElementT(
Element.Html.IFrame,
namespace,
attribute_iterator,
.{ ._proto = undefined },
),
else => {},
},
8 => switch (@as(u64, @bitCast(name[0..8].*))) {

View File

@@ -17,6 +17,8 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
const js = @import("../../../js/js.zig");
const Page = @import("../../../Page.zig");
const Window = @import("../../Window.zig");
const Node = @import("../../Node.zig");
const Element = @import("../../Element.zig");
const HtmlElement = @import("../Html.zig");
@@ -31,6 +33,10 @@ pub fn asNode(self: *IFrame) *Node {
return self.asElement().asNode();
}
pub fn getContentWindow(_: *const IFrame, page: *Page) *Window {
return page.window;
}
pub const JsApi = struct {
pub const bridge = js.Bridge(IFrame);
@@ -39,4 +45,6 @@ pub const JsApi = struct {
pub const prototype_chain = bridge.prototypeChain();
pub var class_id: bridge.ClassId = undefined;
};
pub const contentWindow = bridge.accessor(IFrame.getContentWindow, null, .{});
};