Skip to content

Lightpanda: the headless browser designed for AI and automation

implement textarea.type property

Pierre Tachoire97bb69a56ace
diff --git a/src/browser/tests/element/html/textarea.html b/src/browser/tests/element/html/textarea.html
index 6400e0b87..4ab35f596 100644
--- a/src/browser/tests/element/html/textarea.html
+++ b/src/browser/tests/element/html/textarea.html
@@ -20,6 +20,11 @@
<textarea id="textarea_invalid_form_attr" form="nonexistent">invalid form</textarea>
</form>
+<script id="type">
+ testing.expectEqual('textarea', $('#textarea1').type)
+ testing.expectEqual('textarea', document.createElement('textarea').type)
+</script>
+
<script id="value_initial">
testing.expectEqual('initial text', $('#textarea1').value)
testing.expectEqual('', $('#textarea2').value)
diff --git a/src/browser/webapi/element/html/TextArea.zig b/src/browser/webapi/element/html/TextArea.zig
index a44a4b419..dca6f4c55 100644
--- a/src/browser/webapi/element/html/TextArea.zig
+++ b/src/browser/webapi/element/html/TextArea.zig
@@ -299,6 +299,7 @@ pub const JsApi = struct {
pub const reportValidity = bridge.function(TextArea.reportValidity, .{});
pub const setCustomValidity = bridge.function(TextArea.setCustomValidity, .{});
pub const onselectionchange = bridge.accessor(TextArea.getOnSelectionChange, TextArea.setOnSelectionChange, .{});
+ pub const @"type" = bridge.property("textarea", .{ .template = false, .readonly = true });
pub const value = bridge.accessor(TextArea.getValue, TextArea.setValue, .{});
pub const defaultValue = bridge.accessor(TextArea.getDefaultValue, TextArea.setDefaultValue, .{ .ce_reactions = true });
pub const disabled = reflect.boolean("disabled");