mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-03-22 04:34:44 +00:00
browser.interactive: use for-else expression in role checks
This commit is contained in:
@@ -261,10 +261,9 @@ pub fn isInteractiveRole(role: []const u8) bool {
|
||||
"combobox", "option", "treeitem", "textbox",
|
||||
"listbox", "iframe",
|
||||
};
|
||||
for (interactive_roles) |r| {
|
||||
if (std.ascii.eqlIgnoreCase(role, r)) return true;
|
||||
}
|
||||
return false;
|
||||
return for (interactive_roles) |r| {
|
||||
if (std.ascii.eqlIgnoreCase(role, r)) break true;
|
||||
} else false;
|
||||
}
|
||||
|
||||
pub fn isContentRole(role: []const u8) bool {
|
||||
@@ -274,10 +273,9 @@ pub fn isContentRole(role: []const u8) bool {
|
||||
"article", "region", "main",
|
||||
"navigation",
|
||||
};
|
||||
for (content_roles) |r| {
|
||||
if (std.ascii.eqlIgnoreCase(role, r)) return true;
|
||||
}
|
||||
return false;
|
||||
return for (content_roles) |r| {
|
||||
if (std.ascii.eqlIgnoreCase(role, r)) break true;
|
||||
} else false;
|
||||
}
|
||||
|
||||
fn getRole(el: *Element) ?[]const u8 {
|
||||
|
||||
Reference in New Issue
Block a user