mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-02-04 14:33:47 +00:00
axnode: use select.getValue
This commit is contained in:
@@ -424,27 +424,10 @@ pub const Writer = struct {
|
|||||||
break :blk val;
|
break :blk val;
|
||||||
},
|
},
|
||||||
.select => blk: {
|
.select => blk: {
|
||||||
// Get the selected option's text content
|
const select = el.as(DOMNode.Element.Html.Select);
|
||||||
var it = node.childrenIterator();
|
const val = select.getValue(self.page);
|
||||||
while (it.next()) |child| {
|
if (val.len == 0) break :blk null;
|
||||||
if (child.is(DOMNode.Element.Html) == null) {
|
break :blk val;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
const child_el = child.as(DOMNode.Element);
|
|
||||||
if (child_el.getTag() != .option) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
const option = child_el.as(DOMNode.Element.Html.Option);
|
|
||||||
if (option.getSelected()) {
|
|
||||||
// Get the text content of the option
|
|
||||||
var buf = std.Io.Writer.Allocating.init(self.page.call_arena);
|
|
||||||
try child_el.getInnerText(&buf.writer);
|
|
||||||
const text = buf.written();
|
|
||||||
if (text.len == 0) break :blk null;
|
|
||||||
break :blk text;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break :blk null;
|
|
||||||
},
|
},
|
||||||
else => null,
|
else => null,
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user