webapi/Element: add missing block tags and reorganize checks

This commit is contained in:
Adrià Arrufat
2026-03-09 11:23:52 +09:00
parent d80e926015
commit 330dfccb89

View File

@@ -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,
}; };
} }