mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-03-22 12:44:43 +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",
|
"combobox", "option", "treeitem", "textbox",
|
||||||
"listbox", "iframe",
|
"listbox", "iframe",
|
||||||
};
|
};
|
||||||
for (interactive_roles) |r| {
|
return for (interactive_roles) |r| {
|
||||||
if (std.ascii.eqlIgnoreCase(role, r)) return true;
|
if (std.ascii.eqlIgnoreCase(role, r)) break true;
|
||||||
}
|
} else false;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn isContentRole(role: []const u8) bool {
|
pub fn isContentRole(role: []const u8) bool {
|
||||||
@@ -274,10 +273,9 @@ pub fn isContentRole(role: []const u8) bool {
|
|||||||
"article", "region", "main",
|
"article", "region", "main",
|
||||||
"navigation",
|
"navigation",
|
||||||
};
|
};
|
||||||
for (content_roles) |r| {
|
return for (content_roles) |r| {
|
||||||
if (std.ascii.eqlIgnoreCase(role, r)) return true;
|
if (std.ascii.eqlIgnoreCase(role, r)) break true;
|
||||||
}
|
} else false;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn getRole(el: *Element) ?[]const u8 {
|
fn getRole(el: *Element) ?[]const u8 {
|
||||||
|
|||||||
Reference in New Issue
Block a user