mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-12-16 16:28:58 +00:00
browser: refacto isJS func
This commit is contained in:
@@ -416,6 +416,10 @@ pub const Page = struct {
|
|||||||
// > JavaScript code.
|
// > JavaScript code.
|
||||||
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#attribute_is_not_set_default_an_empty_string_or_a_javascript_mime_type
|
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#attribute_is_not_set_default_an_empty_string_or_a_javascript_mime_type
|
||||||
fn isJS(stype: ?[]const u8) bool {
|
fn isJS(stype: ?[]const u8) bool {
|
||||||
return stype == null or stype.?.len == 0 or std.mem.eql(u8, stype.?, "application/javascript") or !std.mem.eql(u8, stype.?, "module");
|
if (stype == null or stype.?.len == 0) return true;
|
||||||
|
if (std.mem.eql(u8, stype.?, "application/javascript")) return true;
|
||||||
|
if (!std.mem.eql(u8, stype.?, "module")) return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user