mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-03-22 04:34:44 +00:00
webapi/Element: add missing block tags and reorganize checks
This commit is contained in:
@@ -1582,45 +1582,31 @@ pub const Tag = enum {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn isBlock(self: Tag) bool {
|
pub fn isBlock(self: Tag) bool {
|
||||||
|
// zig fmt: off
|
||||||
return switch (self) {
|
return switch (self) {
|
||||||
.p,
|
// Semantic Layout
|
||||||
.div,
|
.article, .aside, .footer, .header, .main, .nav, .section,
|
||||||
.section,
|
// Grouping / Containers
|
||||||
.article,
|
.address, .div, .fieldset, .figure, .p,
|
||||||
.main,
|
// Headings
|
||||||
.header,
|
.h1, .h2, .h3, .h4, .h5, .h6,
|
||||||
.footer,
|
// Lists
|
||||||
.nav,
|
.dl, .ol, .ul,
|
||||||
.aside,
|
// Preformatted / Quotes
|
||||||
.h1,
|
.blockquote, .pre,
|
||||||
.h2,
|
// Tables
|
||||||
.h3,
|
|
||||||
.h4,
|
|
||||||
.h5,
|
|
||||||
.h6,
|
|
||||||
.ul,
|
|
||||||
.ol,
|
|
||||||
.blockquote,
|
|
||||||
.pre,
|
|
||||||
.table,
|
.table,
|
||||||
|
// Other
|
||||||
.hr,
|
.hr,
|
||||||
=> true,
|
=> true,
|
||||||
else => false,
|
else => false,
|
||||||
};
|
};
|
||||||
|
// zig fmt: on
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn isMetadata(self: Tag) bool {
|
pub fn isMetadata(self: Tag) bool {
|
||||||
return switch (self) {
|
return switch (self) {
|
||||||
.script,
|
.base, .head, .link, .meta, .noscript, .script, .style, .template, .title => true,
|
||||||
.style,
|
|
||||||
.meta,
|
|
||||||
.link,
|
|
||||||
.noscript,
|
|
||||||
.head,
|
|
||||||
.title,
|
|
||||||
.base,
|
|
||||||
.template,
|
|
||||||
=> true,
|
|
||||||
else => false,
|
else => false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user