Skip to content

Lightpanda: the headless browser designed for AI and automation

add fieldset.type and output.type

Karl Seguinabdeb76ad80d
diff --git a/src/browser/tests/element/html/fieldset.html b/src/browser/tests/element/html/fieldset.html
index 480aa1061..625fb2021 100644
--- a/src/browser/tests/element/html/fieldset.html
+++ b/src/browser/tests/element/html/fieldset.html
@@ -34,6 +34,11 @@
}
</script>
+<script id="type">
+ testing.expectEqual('fieldset', $('#fs1').type);
+ testing.expectEqual('fieldset', document.createElement('fieldset').type);
+</script>
+
<fieldset id="fs-off" disabled>
<legend><input id="in-legend" type="text"></legend>
<input id="in-body" type="text">
diff --git a/src/browser/tests/element/html/output.html b/src/browser/tests/element/html/output.html
new file mode 100644
index 000000000..2b939eec5
--- /dev/null
+++ b/src/browser/tests/element/html/output.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<script src="../../testing.js"></script>
+
+<output id="out1" name="result">42</output>
+
+<script id="type">
+ testing.expectEqual('output', $('#out1').type);
+ testing.expectEqual('output', document.createElement('output').type);
+</script>
diff --git a/src/browser/webapi/element/html/FieldSet.zig b/src/browser/webapi/element/html/FieldSet.zig
index 1b25f2141..afbd9c7f2 100644
--- a/src/browser/webapi/element/html/FieldSet.zig
+++ b/src/browser/webapi/element/html/FieldSet.zig
@@ -52,6 +52,7 @@ pub const JsApi = struct {
pub const disabled = reflect.boolean("disabled");
pub const name = reflect.string("name");
+ pub const @"type" = bridge.property("fieldset", .{ .template = false, .readonly = true });
};
const testing = @import("../../../../testing.zig");
diff --git a/src/browser/webapi/element/html/Output.zig b/src/browser/webapi/element/html/Output.zig
index 8621a65fc..24ad79b62 100644
--- a/src/browser/webapi/element/html/Output.zig
+++ b/src/browser/webapi/element/html/Output.zig
@@ -70,7 +70,13 @@ pub const JsApi = struct {
const reflect = Element.Reflect(Output);
pub const name = reflect.string("name");
+ pub const @"type" = bridge.property("output", .{ .template = false, .readonly = true });
pub const labels = bridge.accessor(Output.getLabels, null, .{});
pub const htmlFor = bridge.accessor(Output.getHtmlFor, Output.setHtmlFor, .{ .null_as_undefined = true, .ce_reactions = true });
};
+
+const testing = @import("../../../../testing.zig");
+test "WebApi: HTML.Output" {
+ try testing.htmlRunner("element/html/output.html", .{});
+}