Add HTMLDListElement

Fix names for ol and ul elements
This commit is contained in:
Karl Seguin
2026-02-14 17:11:29 +08:00
parent bbff64bc96
commit db46f47b96
8 changed files with 53 additions and 5 deletions

View File

@@ -1575,10 +1575,10 @@ pub fn createElementNS(self: *Page, namespace: Element.Namespace, name: []const
.{ ._proto = undefined, ._tag_name = String.init(undefined, "dd", .{}) catch unreachable, ._tag = .dd }, .{ ._proto = undefined, ._tag_name = String.init(undefined, "dd", .{}) catch unreachable, ._tag = .dd },
), ),
asUint("dl") => return self.createHtmlElementT( asUint("dl") => return self.createHtmlElementT(
Element.Html.Generic, Element.Html.DList,
namespace, namespace,
attribute_iterator, attribute_iterator,
.{ ._proto = undefined, ._tag_name = String.init(undefined, "dl", .{}) catch unreachable, ._tag = .dl }, .{ ._proto = undefined },
), ),
asUint("dt") => return self.createHtmlElementT( asUint("dt") => return self.createHtmlElementT(
Element.Html.Generic, Element.Html.Generic,

View File

@@ -811,6 +811,7 @@ pub const JsApis = flattenTypes(&.{
@import("../webapi/element/html/DataList.zig"), @import("../webapi/element/html/DataList.zig"),
@import("../webapi/element/html/Dialog.zig"), @import("../webapi/element/html/Dialog.zig"),
@import("../webapi/element/html/Directory.zig"), @import("../webapi/element/html/Directory.zig"),
@import("../webapi/element/html/DList.zig"),
@import("../webapi/element/html/Div.zig"), @import("../webapi/element/html/Div.zig"),
@import("../webapi/element/html/Embed.zig"), @import("../webapi/element/html/Embed.zig"),
@import("../webapi/element/html/FieldSet.zig"), @import("../webapi/element/html/FieldSet.zig"),

View File

@@ -210,6 +210,7 @@ pub fn getTagNameLower(self: *const Element) []const u8 {
.dialog => "dialog", .dialog => "dialog",
.directory => "dir", .directory => "dir",
.div => "div", .div => "div",
.dl => "dl",
.embed => "embed", .embed => "embed",
.fieldset => "fieldset", .fieldset => "fieldset",
.font => "font", .font => "font",
@@ -287,6 +288,7 @@ pub fn getTagNameSpec(self: *const Element, buf: []u8) []const u8 {
.dialog => "DIALOG", .dialog => "DIALOG",
.directory => "DIR", .directory => "DIR",
.div => "DIV", .div => "DIV",
.dl => "DL",
.embed => "EMBED", .embed => "EMBED",
.fieldset => "FIELDSET", .fieldset => "FIELDSET",
.font => "FONT", .font => "FONT",
@@ -1275,6 +1277,7 @@ pub fn getTag(self: *const Element) Tag {
.area => .area, .area => .area,
.base => .base, .base => .base,
.div => .div, .div => .div,
.dl => .dl,
.embed => .embed, .embed => .embed,
.form => .form, .form => .form,
.p => .p, .p => .p,

View File

@@ -218,7 +218,7 @@ fn getDefaultDisplay(element: *const Element) []const u8 {
.html => |html| { .html => |html| {
return switch (html._type) { return switch (html._type) {
.anchor, .br, .span, .label, .time, .font, .mod, .quote => "inline", .anchor, .br, .span, .label, .time, .font, .mod, .quote => "inline",
.body, .div, .p, .heading, .form, .button, .canvas, .dialog, .embed, .head, .html, .hr, .iframe, .img, .input, .li, .link, .meta, .ol, .option, .script, .select, .slot, .style, .template, .textarea, .title, .ul, .media, .area, .base, .datalist, .directory, .fieldset, .legend, .map, .meter, .object, .optgroup, .output, .param, .picture, .pre, .progress, .source, .table, .table_caption, .table_cell, .table_col, .table_row, .table_section, .track => "block", .body, .div, .dl, .p, .heading, .form, .button, .canvas, .dialog, .embed, .head, .html, .hr, .iframe, .img, .input, .li, .link, .meta, .ol, .option, .script, .select, .slot, .style, .template, .textarea, .title, .ul, .media, .area, .base, .datalist, .directory, .fieldset, .legend, .map, .meter, .object, .optgroup, .output, .param, .picture, .pre, .progress, .source, .table, .table_caption, .table_cell, .table_col, .table_row, .table_section, .track => "block",
.generic, .custom, .unknown, .data => blk: { .generic, .custom, .unknown, .data => blk: {
const tag = element.getTagNameLower(); const tag = element.getTagNameLower();
if (isInlineTag(tag)) break :blk "inline"; if (isInlineTag(tag)) break :blk "inline";

View File

@@ -42,6 +42,7 @@ pub const DataList = @import("html/DataList.zig");
pub const Dialog = @import("html/Dialog.zig"); pub const Dialog = @import("html/Dialog.zig");
pub const Directory = @import("html/Directory.zig"); pub const Directory = @import("html/Directory.zig");
pub const Div = @import("html/Div.zig"); pub const Div = @import("html/Div.zig");
pub const DList = @import("html/DList.zig");
pub const Embed = @import("html/Embed.zig"); pub const Embed = @import("html/Embed.zig");
pub const FieldSet = @import("html/FieldSet.zig"); pub const FieldSet = @import("html/FieldSet.zig");
pub const Font = @import("html/Font.zig"); pub const Font = @import("html/Font.zig");
@@ -119,6 +120,7 @@ pub const Type = union(enum) {
dialog: *Dialog, dialog: *Dialog,
directory: *Directory, directory: *Directory,
div: *Div, div: *Div,
dl: *DList,
embed: *Embed, embed: *Embed,
fieldset: *FieldSet, fieldset: *FieldSet,
font: *Font, font: *Font,

View File

@@ -0,0 +1,42 @@
// Copyright (C) 2023-2026 Lightpanda (Selecy SAS)
//
// Francis Bouvier <francis@lightpanda.io>
// Pierre Tachoire <pierre@lightpanda.io>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
const js = @import("../../../js/js.zig");
const Node = @import("../../Node.zig");
const Element = @import("../../Element.zig");
const HtmlElement = @import("../Html.zig");
const DList = @This();
_proto: *HtmlElement,
pub fn asElement(self: *DList) *Element {
return self._proto._proto;
}
pub fn asNode(self: *DList) *Node {
return self.asElement().asNode();
}
pub const JsApi = struct {
pub const bridge = js.Bridge(DList);
pub const Meta = struct {
pub const name = "HTMLDListElement";
pub const prototype_chain = bridge.prototypeChain();
pub var class_id: bridge.ClassId = undefined;
};
};

View File

@@ -35,7 +35,7 @@ pub const JsApi = struct {
pub const bridge = js.Bridge(OL); pub const bridge = js.Bridge(OL);
pub const Meta = struct { pub const Meta = struct {
pub const name = "HTMLOLElement"; pub const name = "HTMLOListElement";
pub const prototype_chain = bridge.prototypeChain(); pub const prototype_chain = bridge.prototypeChain();
pub var class_id: bridge.ClassId = undefined; pub var class_id: bridge.ClassId = undefined;
}; };

View File

@@ -35,7 +35,7 @@ pub const JsApi = struct {
pub const bridge = js.Bridge(UL); pub const bridge = js.Bridge(UL);
pub const Meta = struct { pub const Meta = struct {
pub const name = "HTMLULElement"; pub const name = "HTMLUListElement";
pub const prototype_chain = bridge.prototypeChain(); pub const prototype_chain = bridge.prototypeChain();
pub var class_id: bridge.ClassId = undefined; pub var class_id: bridge.ClassId = undefined;
}; };