Skip to content

Lightpanda: the headless browser designed for AI and automation

webapi: add missing HTMLMeterElement accessors

Karl Seguine44395b1b43d
diff --git a/src/browser/tests/element/html/meter.html b/src/browser/tests/element/html/meter.html
new file mode 100644
index 000000000..b80fc8624
--- /dev/null
+++ b/src/browser/tests/element/html/meter.html
@@ -0,0 +1,64 @@
+<!DOCTYPE html>
+<script src="../../testing.js"></script>
+
+<meter id="m1"></meter>
+<meter id="m2" min="10" max="5" value="20" low="1" high="3" optimum="-4"></meter>
+
+<script id="defaults">
+ {
+ const m = document.getElementById('m1');
+ testing.expectEqual(0, m.min);
+ testing.expectEqual(1, m.max);
+ testing.expectEqual(0, m.value);
+ testing.expectEqual(0, m.low);
+ testing.expectEqual(1, m.high);
+ testing.expectEqual(0.5, m.optimum);
+ }
+</script>
+
+<script id="clamping">
+ {
+ // max below min becomes min; everything else is clamped into [min, max]
+ const m = document.getElementById('m2');
+ testing.expectEqual(10, m.min);
+ testing.expectEqual(10, m.max);
+ testing.expectEqual(10, m.value);
+ testing.expectEqual(10, m.low);
+ testing.expectEqual(10, m.high);
+ testing.expectEqual(10, m.optimum);
+ }
+</script>
+
+<script id="high_below_low">
+ {
+ const m = document.createElement('meter');
+ m.setAttribute('max', '10');
+ m.setAttribute('low', '6');
+ m.setAttribute('high', '4');
+ testing.expectEqual(6, m.low);
+ testing.expectEqual(6, m.high);
+ }
+</script>
+
+<script id="setters">
+ {
+ const m = document.createElement('meter');
+ m.max = 100;
+ m.value = 42.5;
+ m.low = 25;
+ testing.expectEqual('100', m.getAttribute('max'));
+ testing.expectEqual('42.5', m.getAttribute('value'));
+ testing.expectEqual('25', m.getAttribute('low'));
+ testing.expectEqual(42.5, m.value);
+
+ // the attribute keeps what was set; only the getter clamps
+ m.value = 500;
+ testing.expectEqual('500', m.getAttribute('value'));
+ testing.expectEqual(100, m.value);
+
+ m.setAttribute('value', 'nope');
+ testing.expectEqual(0, m.value);
+
+ testing.expectError('TypeError', () => { m.value = NaN; });
+ }
+</script>
diff --git a/src/browser/webapi/element/html/Anchor.zig b/src/browser/webapi/element/html/Anchor.zig
index 7bc96f408..cbaf86fbd 100644
--- a/src/browser/webapi/element/html/Anchor.zig
+++ b/src/browser/webapi/element/html/Anchor.zig
@@ -16,13 +16,14 @@
// 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 lp = @import("lightpanda");
const std = @import("std");
+const lp = @import("lightpanda");
+
const js = @import("../../../js/js.zig");
const Factory = @import("../../../Factory.zig");
const Frame = @import("../../../Frame.zig");
-
const URL = @import("../../../URL.zig");
+
const Node = @import("../../Node.zig");
const Element = @import("../../Element.zig");
const HtmlElement = @import("../Html.zig");
diff --git a/src/browser/webapi/element/html/Area.zig b/src/browser/webapi/element/html/Area.zig
index fb8013527..d1cd449f8 100644
--- a/src/browser/webapi/element/html/Area.zig
+++ b/src/browser/webapi/element/html/Area.zig
@@ -13,12 +13,13 @@
// 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 lp = @import("lightpanda");
const std = @import("std");
+const lp = @import("lightpanda");
+
+const URL = @import("../../../URL.zig");
const js = @import("../../../js/js.zig");
-const Factory = @import("../../../Factory.zig");
const Frame = @import("../../../Frame.zig");
-const URL = @import("../../../URL.zig");
+const Factory = @import("../../../Factory.zig");
const Node = @import("../../Node.zig");
const Element = @import("../../Element.zig");
diff --git a/src/browser/webapi/element/html/Audio.zig b/src/browser/webapi/element/html/Audio.zig
index d0b41ba5d..072fa9877 100644
--- a/src/browser/webapi/element/html/Audio.zig
+++ b/src/browser/webapi/element/html/Audio.zig
@@ -19,11 +19,12 @@
const lp = @import("lightpanda");
const js = @import("../../../js/js.zig");
-const Factory = @import("../../../Factory.zig");
const Frame = @import("../../../Frame.zig");
+const Factory = @import("../../../Factory.zig");
const Node = @import("../../Node.zig");
const Element = @import("../../Element.zig");
+
const Media = @import("Media.zig");
const String = lp.String;
diff --git a/src/browser/webapi/element/html/BR.zig b/src/browser/webapi/element/html/BR.zig
index 7a357f390..d005455e9 100644
--- a/src/browser/webapi/element/html/BR.zig
+++ b/src/browser/webapi/element/html/BR.zig
@@ -1,6 +1,23 @@
+// Copyright (C) 2023-2026 Lightpanda (Selecy SAS)
+//
+// 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 lp = @import("lightpanda");
-const Factory = @import("../../../Factory.zig");
+
const js = @import("../../../js/js.zig");
+const Factory = @import("../../../Factory.zig");
+
const Node = @import("../../Node.zig");
const Element = @import("../../Element.zig");
const HtmlElement = @import("../Html.zig");
diff --git a/src/browser/webapi/element/html/Base.zig b/src/browser/webapi/element/html/Base.zig
index 853e84620..25e956d7b 100644
--- a/src/browser/webapi/element/html/Base.zig
+++ b/src/browser/webapi/element/html/Base.zig
@@ -1,11 +1,31 @@
+// Copyright (C) 2023-2026 Lightpanda (Selecy SAS)
+//
+// Francis Bouvier <[email protected]>
+// Pierre Tachoire <[email protected]>
+//
+// 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 lp = @import("lightpanda");
-const Factory = @import("../../../Factory.zig");
+
const js = @import("../../../js/js.zig");
-const URL = @import("../../../URL.zig");
const Frame = @import("../../../Frame.zig");
+const URL = @import("../../../URL.zig");
+const Factory = @import("../../../Factory.zig");
const Node = @import("../../Node.zig");
const Element = @import("../../Element.zig");
+
const HtmlElement = @import("../Html.zig");
const Base = @This();
diff --git a/src/browser/webapi/element/html/Body.zig b/src/browser/webapi/element/html/Body.zig
index c7897eac7..84a545a43 100644
--- a/src/browser/webapi/element/html/Body.zig
+++ b/src/browser/webapi/element/html/Body.zig
@@ -18,8 +18,8 @@
const lp = @import("lightpanda");
const js = @import("../../../js/js.zig");
-const Factory = @import("../../../Factory.zig");
const Frame = @import("../../../Frame.zig");
+const Factory = @import("../../../Factory.zig");
const Node = @import("../../Node.zig");
const Element = @import("../../Element.zig");
diff --git a/src/browser/webapi/element/html/Button.zig b/src/browser/webapi/element/html/Button.zig
index 724d37585..91f057a8a 100644
--- a/src/browser/webapi/element/html/Button.zig
+++ b/src/browser/webapi/element/html/Button.zig
@@ -24,14 +24,15 @@ const Factory = @import("../../../Factory.zig");
const Frame = @import("../../../Frame.zig");
const Node = @import("../../Node.zig");
+const Event = @import("../../Event.zig");
const Element = @import("../../Element.zig");
+
const HtmlElement = @import("../Html.zig");
+const popover = @import("../popover.zig");
+
const Form = @import("Form.zig");
-const Event = @import("../../Event.zig");
const ValidityState = @import("ValidityState.zig");
-const popover = @import("../popover.zig");
-
const Button = @This();
pub const Proto = HtmlElement;
diff --git a/src/browser/webapi/element/html/DList.zig b/src/browser/webapi/element/html/DList.zig
index a57aa928e..1f65ea52c 100644
--- a/src/browser/webapi/element/html/DList.zig
+++ b/src/browser/webapi/element/html/DList.zig
@@ -17,10 +17,13 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
const lp = @import("lightpanda");
-const Factory = @import("../../../Factory.zig");
+
const js = @import("../../../js/js.zig");
+const Factory = @import("../../../Factory.zig");
+
const Node = @import("../../Node.zig");
const Element = @import("../../Element.zig");
+
const HtmlElement = @import("../Html.zig");
const DList = @This();
diff --git a/src/browser/webapi/element/html/DataList.zig b/src/browser/webapi/element/html/DataList.zig
index ef85c9fe4..659501213 100644
--- a/src/browser/webapi/element/html/DataList.zig
+++ b/src/browser/webapi/element/html/DataList.zig
@@ -1,8 +1,29 @@
+// Copyright (C) 2023-2026 Lightpanda (Selecy SAS)
+//
+// Francis Bouvier <[email protected]>
+// Pierre Tachoire <[email protected]>
+//
+// 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 lp = @import("lightpanda");
-const Factory = @import("../../../Factory.zig");
+
const js = @import("../../../js/js.zig");
+const Factory = @import("../../../Factory.zig");
+
const Node = @import("../../Node.zig");
const Element = @import("../../Element.zig");
+
const HtmlElement = @import("../Html.zig");
const DataList = @This();
diff --git a/src/browser/webapi/element/html/Details.zig b/src/browser/webapi/element/html/Details.zig
index 6a3953b83..5adb6de71 100644
--- a/src/browser/webapi/element/html/Details.zig
+++ b/src/browser/webapi/element/html/Details.zig
@@ -1,10 +1,30 @@
+// Copyright (C) 2023-2026 Lightpanda (Selecy SAS)
+//
+// Francis Bouvier <[email protected]>
+// Pierre Tachoire <[email protected]>
+//
+// 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 lp = @import("lightpanda");
-const Factory = @import("../../../Factory.zig");
+
const js = @import("../../../js/js.zig");
const Frame = @import("../../../Frame.zig");
+const Factory = @import("../../../Factory.zig");
const Node = @import("../../Node.zig");
const Element = @import("../../Element.zig");
+
const HtmlElement = @import("../Html.zig");
const Details = @This();
diff --git a/src/browser/webapi/element/html/Dialog.zig b/src/browser/webapi/element/html/Dialog.zig
index 9cdfb9833..bd2454b89 100644
--- a/src/browser/webapi/element/html/Dialog.zig
+++ b/src/browser/webapi/element/html/Dialog.zig
@@ -1,11 +1,31 @@
+// Copyright (C) 2023-2026 Lightpanda (Selecy SAS)
+//
+// Francis Bouvier <[email protected]>
+// Pierre Tachoire <[email protected]>
+//
+// 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 lp = @import("lightpanda");
-const Factory = @import("../../../Factory.zig");
+
const js = @import("../../../js/js.zig");
const Frame = @import("../../../Frame.zig");
+const Factory = @import("../../../Factory.zig");
const Event = @import("../../Event.zig");
const Node = @import("../../Node.zig");
const Element = @import("../../Element.zig");
+
const HtmlElement = @import("../Html.zig");
const Dialog = @This();
diff --git a/src/browser/webapi/element/html/Directory.zig b/src/browser/webapi/element/html/Directory.zig
index 8c166adcc..415aa85b1 100644
--- a/src/browser/webapi/element/html/Directory.zig
+++ b/src/browser/webapi/element/html/Directory.zig
@@ -1,8 +1,29 @@
+// Copyright (C) 2023-2026 Lightpanda (Selecy SAS)
+//
+// Francis Bouvier <[email protected]>
+// Pierre Tachoire <[email protected]>
+//
+// 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 lp = @import("lightpanda");
-const Factory = @import("../../../Factory.zig");
+
const js = @import("../../../js/js.zig");
+const Factory = @import("../../../Factory.zig");
+
const Node = @import("../../Node.zig");
const Element = @import("../../Element.zig");
+
const HtmlElement = @import("../Html.zig");
const Directory = @This();
diff --git a/src/browser/webapi/element/html/Div.zig b/src/browser/webapi/element/html/Div.zig
index 5f78e1509..8cfd22260 100644
--- a/src/browser/webapi/element/html/Div.zig
+++ b/src/browser/webapi/element/html/Div.zig
@@ -17,10 +17,13 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
const lp = @import("lightpanda");
-const Factory = @import("../../../Factory.zig");
+
const js = @import("../../../js/js.zig");
+const Factory = @import("../../../Factory.zig");
+
const Node = @import("../../Node.zig");
const Element = @import("../../Element.zig");
+
const HtmlElement = @import("../Html.zig");
const Div = @This();
diff --git a/src/browser/webapi/element/html/Embed.zig b/src/browser/webapi/element/html/Embed.zig
index 899e7b5e7..31408a7f5 100644
--- a/src/browser/webapi/element/html/Embed.zig
+++ b/src/browser/webapi/element/html/Embed.zig
@@ -17,11 +17,14 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
const lp = @import("lightpanda");
-const Factory = @import("../../../Factory.zig");
+
const js = @import("../../../js/js.zig");
const Frame = @import("../../../Frame.zig");
+const Factory = @import("../../../Factory.zig");
+
const Node = @import("../../Node.zig");
const Element = @import("../../Element.zig");
+
const HtmlElement = @import("../Html.zig");
const Embed = @This();
diff --git a/src/browser/webapi/element/html/FieldSet.zig b/src/browser/webapi/element/html/FieldSet.zig
index 34aa57196..1b25f2141 100644
--- a/src/browser/webapi/element/html/FieldSet.zig
+++ b/src/browser/webapi/element/html/FieldSet.zig
@@ -1,8 +1,28 @@
+// Copyright (C) 2023-2026 Lightpanda (Selecy SAS)
+//
+// Francis Bouvier <[email protected]>
+// Pierre Tachoire <[email protected]>
+//
+// 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
+
const lp = @import("lightpanda");
-const Factory = @import("../../../Factory.zig");
+
const js = @import("../../../js/js.zig");
+const Factory = @import("../../../Factory.zig");
+
const Node = @import("../../Node.zig");
const Element = @import("../../Element.zig");
+
const HtmlElement = @import("../Html.zig");
const FieldSet = @This();
diff --git a/src/browser/webapi/element/html/Font.zig b/src/browser/webapi/element/html/Font.zig
index a75df0d95..208d7df68 100644
--- a/src/browser/webapi/element/html/Font.zig
+++ b/src/browser/webapi/element/html/Font.zig
@@ -1,9 +1,29 @@
+// Copyright (C) 2023-2026 Lightpanda (Selecy SAS)
+//
+// Francis Bouvier <[email protected]>
+// Pierre Tachoire <[email protected]>
+//
+// 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
+
const lp = @import("lightpanda");
-const Factory = @import("../../../Factory.zig");
+
const js = @import("../../../js/js.zig");
const Frame = @import("../../../Frame.zig");
+const Factory = @import("../../../Factory.zig");
+
const Node = @import("../../Node.zig");
const Element = @import("../../Element.zig");
+
const HtmlElement = @import("../Html.zig");
const Font = @This();
diff --git a/src/browser/webapi/element/html/Form.zig b/src/browser/webapi/element/html/Form.zig
index 78a73b491..44cf990c8 100644
--- a/src/browser/webapi/element/html/Form.zig
+++ b/src/browser/webapi/element/html/Form.zig
@@ -16,8 +16,9 @@
// 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 lp = @import("lightpanda");
const std = @import("std");
+const lp = @import("lightpanda");
+
const js = @import("../../../js/js.zig");
const Factory = @import("../../../Factory.zig");
const Frame = @import("../../../Frame.zig");
diff --git a/src/browser/webapi/element/html/FrameSet.zig b/src/browser/webapi/element/html/FrameSet.zig
index d5202e53d..fb4789a9a 100644
--- a/src/browser/webapi/element/html/FrameSet.zig
+++ b/src/browser/webapi/element/html/FrameSet.zig
@@ -1,11 +1,30 @@
+// Copyright (C) 2023-2026 Lightpanda (Selecy SAS)
+//
+// Francis Bouvier <[email protected]>
+// Pierre Tachoire <[email protected]>
+//
+// 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
+
const lp = @import("lightpanda");
const js = @import("../../../js/js.zig");
-const Factory = @import("../../../Factory.zig");
const Frame = @import("../../../Frame.zig");
+const Factory = @import("../../../Factory.zig");
+
const Node = @import("../../Node.zig");
-const Element = @import("../../Element.zig");
const Window = @import("../../Window.zig");
+const Element = @import("../../Element.zig");
+
const HtmlElement = @import("../Html.zig");
const String = lp.String;
diff --git a/src/browser/webapi/element/html/HR.zig b/src/browser/webapi/element/html/HR.zig
index 13a44c315..6a45a7ed1 100644
--- a/src/browser/webapi/element/html/HR.zig
+++ b/src/browser/webapi/element/html/HR.zig
@@ -17,10 +17,13 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
const lp = @import("lightpanda");
-const Factory = @import("../../../Factory.zig");
+
const js = @import("../../../js/js.zig");
+const Factory = @import("../../../Factory.zig");
+
const Node = @import("../../Node.zig");
const Element = @import("../../Element.zig");
+
const HtmlElement = @import("../Html.zig");
const HR = @This();
diff --git a/src/browser/webapi/element/html/Head.zig b/src/browser/webapi/element/html/Head.zig
index bb17950c3..91d81605f 100644
--- a/src/browser/webapi/element/html/Head.zig
+++ b/src/browser/webapi/element/html/Head.zig
@@ -17,10 +17,13 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
const lp = @import("lightpanda");
-const Factory = @import("../../../Factory.zig");
+
const js = @import("../../../js/js.zig");
+const Factory = @import("../../../Factory.zig");
+
const Node = @import("../../Node.zig");
const Element = @import("../../Element.zig");
+
const HtmlElement = @import("../Html.zig");
const Head = @This();
diff --git a/src/browser/webapi/element/html/Html.zig b/src/browser/webapi/element/html/Html.zig
index d651b9347..3b6a0a2c1 100644
--- a/src/browser/webapi/element/html/Html.zig
+++ b/src/browser/webapi/element/html/Html.zig
@@ -17,10 +17,13 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
const lp = @import("lightpanda");
-const Factory = @import("../../../Factory.zig");
+
const js = @import("../../../js/js.zig");
+const Factory = @import("../../../Factory.zig");
+
const Node = @import("../../Node.zig");
const Element = @import("../../Element.zig");
+
const HtmlElement = @import("../Html.zig");
const Html = @This();
diff --git a/src/browser/webapi/element/html/LI.zig b/src/browser/webapi/element/html/LI.zig
index 9a764b216..59dafbaf0 100644
--- a/src/browser/webapi/element/html/LI.zig
+++ b/src/browser/webapi/element/html/LI.zig
@@ -1,4 +1,4 @@
-// Copyright (C) 2023-2025 Lightpanda (Selecy SAS)
+// Copyright (C) 2023-2026 Lightpanda (Selecy SAS)
//
// Francis Bouvier <[email protected]>
// Pierre Tachoire <[email protected]>
@@ -17,10 +17,13 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
const lp = @import("lightpanda");
+
const js = @import("../../../js/js.zig");
const Factory = @import("../../../Factory.zig");
+
const Node = @import("../../Node.zig");
const Element = @import("../../Element.zig");
+
const HtmlElement = @import("../Html.zig");
const LI = @This();
diff --git a/src/browser/webapi/element/html/Label.zig b/src/browser/webapi/element/html/Label.zig
index 2511b6e3a..679532f54 100644
--- a/src/browser/webapi/element/html/Label.zig
+++ b/src/browser/webapi/element/html/Label.zig
@@ -1,13 +1,33 @@
-const lp = @import("lightpanda");
+// Copyright (C) 2023-2026 Lightpanda (Selecy SAS)
+//
+// Francis Bouvier <[email protected]>
+// Pierre Tachoire <[email protected]>
+//
+// 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
+
const std = @import("std");
+const lp = @import("lightpanda");
+
const js = @import("../../../js/js.zig");
-const Factory = @import("../../../Factory.zig");
const Frame = @import("../../../Frame.zig");
+const Factory = @import("../../../Factory.zig");
+
const Node = @import("../../Node.zig");
const Element = @import("../../Element.zig");
-const HtmlElement = @import("../Html.zig");
const TreeWalker = @import("../../TreeWalker.zig");
+const HtmlElement = @import("../Html.zig");
+
const Label = @This();
pub const Proto = HtmlElement;
diff --git a/src/browser/webapi/element/html/Legend.zig b/src/browser/webapi/element/html/Legend.zig
index 16d2a1ff3..92406beab 100644
--- a/src/browser/webapi/element/html/Legend.zig
+++ b/src/browser/webapi/element/html/Legend.zig
@@ -1,8 +1,27 @@
+// Copyright (C) 2023-2026 Lightpanda (Selecy SAS)
+//
+// Francis Bouvier <[email protected]>
+// Pierre Tachoire <[email protected]>
+//
+// 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
+
const lp = @import("lightpanda");
-const Factory = @import("../../../Factory.zig");
+
const js = @import("../../../js/js.zig");
+const Factory = @import("../../../Factory.zig");
const Node = @import("../../Node.zig");
const Element = @import("../../Element.zig");
+
const HtmlElement = @import("../Html.zig");
const Legend = @This();
diff --git a/src/browser/webapi/element/html/Map.zig b/src/browser/webapi/element/html/Map.zig
index eebea3e5f..6ec4bda0e 100644
--- a/src/browser/webapi/element/html/Map.zig
+++ b/src/browser/webapi/element/html/Map.zig
@@ -1,8 +1,28 @@
+// Copyright (C) 2023-2026 Lightpanda (Selecy SAS)
+//
+// Francis Bouvier <[email protected]>
+// Pierre Tachoire <[email protected]>
+//
+// 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
+
const lp = @import("lightpanda");
-const Factory = @import("../../../Factory.zig");
+
const js = @import("../../../js/js.zig");
+const Factory = @import("../../../Factory.zig");
+
const Node = @import("../../Node.zig");
const Element = @import("../../Element.zig");
+
const HtmlElement = @import("../Html.zig");
const Map = @This();
diff --git a/src/browser/webapi/element/html/Marquee.zig b/src/browser/webapi/element/html/Marquee.zig
index bb8fdd9d8..1cd5b3511 100644
--- a/src/browser/webapi/element/html/Marquee.zig
+++ b/src/browser/webapi/element/html/Marquee.zig
@@ -1,9 +1,28 @@
+// Copyright (C) 2023-2026 Lightpanda (Selecy SAS)
+//
+// Francis Bouvier <[email protected]>
+// Pierre Tachoire <[email protected]>
+//
+// 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
+
const lp = @import("lightpanda");
const js = @import("../../../js/js.zig");
const Factory = @import("../../../Factory.zig");
+
const Node = @import("../../Node.zig");
const Element = @import("../../Element.zig");
+
const HtmlElement = @import("../Html.zig");
const Marquee = @This();
diff --git a/src/browser/webapi/element/html/Media.zig b/src/browser/webapi/element/html/Media.zig
index 1aa7a6ff1..aef99e9a1 100644
--- a/src/browser/webapi/element/html/Media.zig
+++ b/src/browser/webapi/element/html/Media.zig
@@ -18,17 +18,20 @@
const std = @import("std");
const lp = @import("lightpanda");
+
const js = @import("../../../js/js.zig");
const Frame = @import("../../../Frame.zig");
+const Factory = @import("../../../Factory.zig");
const Node = @import("../../Node.zig");
const Element = @import("../../Element.zig");
-const Factory = @import("../../../Factory.zig");
-const HtmlElement = @import("../Html.zig");
const Event = @import("../../Event.zig");
+
+const HtmlElement = @import("../Html.zig");
+const MediaError = @import("../../media/MediaError.zig");
+
pub const Audio = @import("Audio.zig");
pub const Video = @import("Video.zig");
-const MediaError = @import("../../media/MediaError.zig");
const Media = @This();
diff --git a/src/browser/webapi/element/html/Meter.zig b/src/browser/webapi/element/html/Meter.zig
index 60f7405fd..da5806346 100644
--- a/src/browser/webapi/element/html/Meter.zig
+++ b/src/browser/webapi/element/html/Meter.zig
@@ -1,10 +1,32 @@
+// Copyright (C) 2023-2025 Lightpanda (Selecy SAS)
+//
+// Francis Bouvier <[email protected]>
+// Pierre Tachoire <[email protected]>
+//
+// 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 std = @import("std");
const lp = @import("lightpanda");
-const Factory = @import("../../../Factory.zig");
+
const js = @import("../../../js/js.zig");
const Frame = @import("../../../Frame.zig");
+const Factory = @import("../../../Factory.zig");
+
const Node = @import("../../Node.zig");
const Element = @import("../../Element.zig");
const HtmlElement = @import("../Html.zig");
+const reflection = @import("../reflection.zig");
const Meter = @This();
@@ -20,6 +42,46 @@ pub fn asNode(self: *Meter) *Node {
return self.asElement().asNode();
}
+fn attribute(self: *const Meter, comptime name: []const u8) ?f64 {
+ return reflection.getDouble(Factory.protoOf(self).asElement(), name);
+}
+
+fn getMin(self: *const Meter) f64 {
+ return self.attribute("min") orelse 0;
+}
+
+fn getMax(self: *const Meter) f64 {
+ return @max(self.attribute("max") orelse 1, self.getMin());
+}
+
+fn getValue(self: *const Meter) f64 {
+ return std.math.clamp(self.attribute("value") orelse 0, self.getMin(), self.getMax());
+}
+
+fn getLow(self: *const Meter) f64 {
+ const min = self.getMin();
+ return std.math.clamp(self.attribute("low") orelse min, min, self.getMax());
+}
+
+fn getHigh(self: *const Meter) f64 {
+ const max = self.getMax();
+ return std.math.clamp(self.attribute("high") orelse max, self.getLow(), max);
+}
+
+fn getOptimum(self: *const Meter) f64 {
+ const min = self.getMin();
+ const max = self.getMax();
+ return std.math.clamp(self.attribute("optimum") orelse (min + max) / 2, min, max);
+}
+
+fn setter(comptime name: []const u8) fn (*Meter, f64, *Frame) anyerror!void {
+ return struct {
+ fn set(self: *Meter, value: f64, frame: *Frame) !void {
+ return reflection.setDouble(self.asElement(), name, value, frame);
+ }
+ }.set;
+}
+
fn getLabels(self: *Meter, frame: *Frame) !js.Array {
return @import("Label.zig").getControlLabels(self.asElement(), frame);
}
@@ -33,5 +95,16 @@ pub const JsApi = struct {
pub var class_id: bridge.ClassId = undefined;
};
+ pub const value = bridge.accessor(Meter.getValue, setter("value"), .{ .ce_reactions = true });
+ pub const min = bridge.accessor(Meter.getMin, setter("min"), .{ .ce_reactions = true });
+ pub const max = bridge.accessor(Meter.getMax, setter("max"), .{ .ce_reactions = true });
+ pub const low = bridge.accessor(Meter.getLow, setter("low"), .{ .ce_reactions = true });
+ pub const high = bridge.accessor(Meter.getHigh, setter("high"), .{ .ce_reactions = true });
+ pub const optimum = bridge.accessor(Meter.getOptimum, setter("optimum"), .{ .ce_reactions = true });
pub const labels = bridge.accessor(Meter.getLabels, null, .{});
};
+
+const testing = @import("../../../../testing.zig");
+test "WebApi: HTML.Meter" {
+ try testing.htmlRunner("element/html/meter.html", .{});
+}
diff --git a/src/browser/webapi/element/html/Mod.zig b/src/browser/webapi/element/html/Mod.zig
index 069e3a7cb..cf14b1d6e 100644
--- a/src/browser/webapi/element/html/Mod.zig
+++ b/src/browser/webapi/element/html/Mod.zig
@@ -1,9 +1,27 @@
+// Copyright (C) 2023-2026 Lightpanda (Selecy SAS)
+//
+// Francis Bouvier <[email protected]>
+// Pierre Tachoire <[email protected]>
+//
+// 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
const lp = @import("lightpanda");
const js = @import("../../../js/js.zig");
const Factory = @import("../../../Factory.zig");
+
const Node = @import("../../Node.zig");
const Element = @import("../../Element.zig");
+
const HtmlElement = @import("../Html.zig");
const String = lp.String;
diff --git a/src/browser/webapi/element/html/OL.zig b/src/browser/webapi/element/html/OL.zig
index 04aa5139a..42dc4808f 100644
--- a/src/browser/webapi/element/html/OL.zig
+++ b/src/browser/webapi/element/html/OL.zig
@@ -17,11 +17,14 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
const lp = @import("lightpanda");
+
const js = @import("../../../js/js.zig");
-const Factory = @import("../../../Factory.zig");
const Frame = @import("../../../Frame.zig");
+const Factory = @import("../../../Factory.zig");
+
const Node = @import("../../Node.zig");
const Element = @import("../../Element.zig");
+
const HtmlElement = @import("../Html.zig");
const OL = @This();
diff --git a/src/browser/webapi/element/html/Object.zig b/src/browser/webapi/element/html/Object.zig
index 3025804bd..76b005c95 100644
--- a/src/browser/webapi/element/html/Object.zig
+++ b/src/browser/webapi/element/html/Object.zig
@@ -1,8 +1,28 @@
+// Copyright (C) 2023-2026 Lightpanda (Selecy SAS)
+//
+// Francis Bouvier <[email protected]>
+// Pierre Tachoire <[email protected]>
+//
+// 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
+
const lp = @import("lightpanda");
-const Factory = @import("../../../Factory.zig");
+
const js = @import("../../../js/js.zig");
+const Factory = @import("../../../Factory.zig");
+
const Node = @import("../../Node.zig");
const Element = @import("../../Element.zig");
+
const HtmlElement = @import("../Html.zig");
const Object = @This();
diff --git a/src/browser/webapi/element/html/OptGroup.zig b/src/browser/webapi/element/html/OptGroup.zig
index aa1674cc6..e07240ad2 100644
--- a/src/browser/webapi/element/html/OptGroup.zig
+++ b/src/browser/webapi/element/html/OptGroup.zig
@@ -1,8 +1,28 @@
+// Copyright (C) 2023-2026 Lightpanda (Selecy SAS)
+//
+// Francis Bouvier <[email protected]>
+// Pierre Tachoire <[email protected]>
+//
+// 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
+
const lp = @import("lightpanda");
-const Factory = @import("../../../Factory.zig");
+
const js = @import("../../../js/js.zig");
+const Factory = @import("../../../Factory.zig");
+
const Node = @import("../../Node.zig");
const Element = @import("../../Element.zig");
+
const HtmlElement = @import("../Html.zig");
const OptGroup = @This();
diff --git a/src/browser/webapi/element/html/Paragraph.zig b/src/browser/webapi/element/html/Paragraph.zig
index 33581e072..a64d2cd4e 100644
--- a/src/browser/webapi/element/html/Paragraph.zig
+++ b/src/browser/webapi/element/html/Paragraph.zig
@@ -17,10 +17,13 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
const lp = @import("lightpanda");
-const Factory = @import("../../../Factory.zig");
+
const js = @import("../../../js/js.zig");
+const Factory = @import("../../../Factory.zig");
+
const Node = @import("../../Node.zig");
const Element = @import("../../Element.zig");
+
const HtmlElement = @import("../Html.zig");
const Paragraph = @This();
diff --git a/src/browser/webapi/element/html/Param.zig b/src/browser/webapi/element/html/Param.zig
index affa185ae..7aa60454a 100644
--- a/src/browser/webapi/element/html/Param.zig
+++ b/src/browser/webapi/element/html/Param.zig
@@ -1,8 +1,28 @@
+// Copyright (C) 2023-2026 Lightpanda (Selecy SAS)
+//
+// Francis Bouvier <[email protected]>
+// Pierre Tachoire <[email protected]>
+//
+// 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
+
const lp = @import("lightpanda");
-const Factory = @import("../../../Factory.zig");
+
const js = @import("../../../js/js.zig");
+const Factory = @import("../../../Factory.zig");
+
const Node = @import("../../Node.zig");
const Element = @import("../../Element.zig");
+
const HtmlElement = @import("../Html.zig");
const Param = @This();
diff --git a/src/browser/webapi/element/html/Pre.zig b/src/browser/webapi/element/html/Pre.zig
index ecf7a047e..ec1ce2ac0 100644
--- a/src/browser/webapi/element/html/Pre.zig
+++ b/src/browser/webapi/element/html/Pre.zig
@@ -1,8 +1,28 @@
+// Copyright (C) 2023-2026 Lightpanda (Selecy SAS)
+//
+// Francis Bouvier <[email protected]>
+// Pierre Tachoire <[email protected]>
+//
+// 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
+
const lp = @import("lightpanda");
-const Factory = @import("../../../Factory.zig");
+
const js = @import("../../../js/js.zig");
+const Factory = @import("../../../Factory.zig");
+
const Node = @import("../../Node.zig");
const Element = @import("../../Element.zig");
+
const HtmlElement = @import("../Html.zig");
const Pre = @This();
diff --git a/src/browser/webapi/element/html/Progress.zig b/src/browser/webapi/element/html/Progress.zig
index 542e88c8e..9a2bd768c 100644
--- a/src/browser/webapi/element/html/Progress.zig
+++ b/src/browser/webapi/element/html/Progress.zig
@@ -1,9 +1,30 @@
+// Copyright (C) 2023-2025 Lightpanda (Selecy SAS)
+//
+// Francis Bouvier <[email protected]>
+// Pierre Tachoire <[email protected]>
+//
+// 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 lp = @import("lightpanda");
-const Factory = @import("../../../Factory.zig");
+
const js = @import("../../../js/js.zig");
const Frame = @import("../../../Frame.zig");
+const Factory = @import("../../../Factory.zig");
+
const Node = @import("../../Node.zig");
const Element = @import("../../Element.zig");
+
const HtmlElement = @import("../Html.zig");
const Progress = @This();
diff --git a/src/browser/webapi/element/html/Quote.zig b/src/browser/webapi/element/html/Quote.zig
index 753a5dbfb..15db53cd8 100644
--- a/src/browser/webapi/element/html/Quote.zig
+++ b/src/browser/webapi/element/html/Quote.zig
@@ -1,10 +1,29 @@
+// Copyright (C) 2023-2026 Lightpanda (Selecy SAS)
+//
+// Francis Bouvier <[email protected]>
+// Pierre Tachoire <[email protected]>
+//
+// 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
+
const lp = @import("lightpanda");
const js = @import("../../../js/js.zig");
-const Factory = @import("../../../Factory.zig");
const Frame = @import("../../../Frame.zig");
+const Factory = @import("../../../Factory.zig");
+
const Node = @import("../../Node.zig");
const Element = @import("../../Element.zig");
+
const HtmlElement = @import("../Html.zig");
const String = lp.String;
diff --git a/src/browser/webapi/element/html/Slot.zig b/src/browser/webapi/element/html/Slot.zig
index 864414aed..42542f91d 100644
--- a/src/browser/webapi/element/html/Slot.zig
+++ b/src/browser/webapi/element/html/Slot.zig
@@ -1,10 +1,30 @@
-const lp = @import("lightpanda");
+// Copyright (C) 2023-2026 Lightpanda (Selecy SAS)
+//
+// Francis Bouvier <[email protected]>
+// Pierre Tachoire <[email protected]>
+//
+// 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
+
const std = @import("std");
+const lp = @import("lightpanda");
+
const js = @import("../../../js/js.zig");
-const Factory = @import("../../../Factory.zig");
const Frame = @import("../../../Frame.zig");
+const Factory = @import("../../../Factory.zig");
+
const Node = @import("../../Node.zig");
const Element = @import("../../Element.zig");
+
const HtmlElement = @import("../Html.zig");
const slotting = @import("../slotting.zig");
diff --git a/src/browser/webapi/element/html/Span.zig b/src/browser/webapi/element/html/Span.zig
index 125252cd0..a326b43c9 100644
--- a/src/browser/webapi/element/html/Span.zig
+++ b/src/browser/webapi/element/html/Span.zig
@@ -1,8 +1,28 @@
+// Copyright (C) 2023-2026 Lightpanda (Selecy SAS)
+//
+// Francis Bouvier <[email protected]>
+// Pierre Tachoire <[email protected]>
+//
+// 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
+
const lp = @import("lightpanda");
-const Factory = @import("../../../Factory.zig");
+
const js = @import("../../../js/js.zig");
+const Factory = @import("../../../Factory.zig");
+
const Node = @import("../../Node.zig");
const Element = @import("../../Element.zig");
+
const HtmlElement = @import("../Html.zig");
const Span = @This();
diff --git a/src/browser/webapi/element/html/Style.zig b/src/browser/webapi/element/html/Style.zig
index 44adc191c..74d66f7f6 100644
--- a/src/browser/webapi/element/html/Style.zig
+++ b/src/browser/webapi/element/html/Style.zig
@@ -16,11 +16,12 @@
// 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 lp = @import("lightpanda");
const std = @import("std");
+const lp = @import("lightpanda");
+
const js = @import("../../../js/js.zig");
-const Factory = @import("../../../Factory.zig");
const Frame = @import("../../../Frame.zig");
+const Factory = @import("../../../Factory.zig");
const Node = @import("../../Node.zig");
const Element = @import("../../Element.zig");
diff --git a/src/browser/webapi/element/html/Table.zig b/src/browser/webapi/element/html/Table.zig
index df5b6d072..de601d581 100644
--- a/src/browser/webapi/element/html/Table.zig
+++ b/src/browser/webapi/element/html/Table.zig
@@ -1,12 +1,32 @@
+// Copyright (C) 2023-2026 Lightpanda (Selecy SAS)
+//
+// Francis Bouvier <[email protected]>
+// Pierre Tachoire <[email protected]>
+//
+// 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
+
const lp = @import("lightpanda");
-const Factory = @import("../../../Factory.zig");
+
const js = @import("../../../js/js.zig");
-const Node = @import("../../Node.zig");
const Frame = @import("../../../Frame.zig");
+const Factory = @import("../../../Factory.zig");
+
+const Node = @import("../../Node.zig");
const Element = @import("../../Element.zig");
-const HtmlElement = @import("../Html.zig");
const collections = @import("../../collections.zig");
+const HtmlElement = @import("../Html.zig");
+
const Table = @This();
pub const Proto = HtmlElement;
diff --git a/src/browser/webapi/element/html/TableCaption.zig b/src/browser/webapi/element/html/TableCaption.zig
index 9cee4daf8..9c9b64e37 100644
--- a/src/browser/webapi/element/html/TableCaption.zig
+++ b/src/browser/webapi/element/html/TableCaption.zig
@@ -1,8 +1,28 @@
+// Copyright (C) 2023-2026 Lightpanda (Selecy SAS)
+//
+// Francis Bouvier <[email protected]>
+// Pierre Tachoire <[email protected]>
+//
+// 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
+
const lp = @import("lightpanda");
-const Factory = @import("../../../Factory.zig");
+
const js = @import("../../../js/js.zig");
+const Factory = @import("../../../Factory.zig");
+
const Node = @import("../../Node.zig");
const Element = @import("../../Element.zig");
+
const HtmlElement = @import("../Html.zig");
const TableCaption = @This();
diff --git a/src/browser/webapi/element/html/TableCell.zig b/src/browser/webapi/element/html/TableCell.zig
index fa54da180..9321622c3 100644
--- a/src/browser/webapi/element/html/TableCell.zig
+++ b/src/browser/webapi/element/html/TableCell.zig
@@ -1,9 +1,28 @@
+// Copyright (C) 2023-2026 Lightpanda (Selecy SAS)
+//
+// Francis Bouvier <[email protected]>
+// Pierre Tachoire <[email protected]>
+//
+// 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
+
const lp = @import("lightpanda");
const js = @import("../../../js/js.zig");
const Factory = @import("../../../Factory.zig");
+
const Node = @import("../../Node.zig");
const Element = @import("../../Element.zig");
+
const HtmlElement = @import("../Html.zig");
const String = lp.String;
diff --git a/src/browser/webapi/element/html/TableCol.zig b/src/browser/webapi/element/html/TableCol.zig
index 5b27c61e5..57f028918 100644
--- a/src/browser/webapi/element/html/TableCol.zig
+++ b/src/browser/webapi/element/html/TableCol.zig
@@ -1,9 +1,28 @@
+// Copyright (C) 2023-2026 Lightpanda (Selecy SAS)
+//
+// Francis Bouvier <[email protected]>
+// Pierre Tachoire <[email protected]>
+//
+// 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
+
const lp = @import("lightpanda");
const js = @import("../../../js/js.zig");
const Factory = @import("../../../Factory.zig");
+
const Node = @import("../../Node.zig");
const Element = @import("../../Element.zig");
+
const HtmlElement = @import("../Html.zig");
const String = lp.String;
diff --git a/src/browser/webapi/element/html/TableRow.zig b/src/browser/webapi/element/html/TableRow.zig
index d13f45871..2408d7042 100644
--- a/src/browser/webapi/element/html/TableRow.zig
+++ b/src/browser/webapi/element/html/TableRow.zig
@@ -1,12 +1,32 @@
+// Copyright (C) 2023-2026 Lightpanda (Selecy SAS)
+//
+// Francis Bouvier <[email protected]>
+// Pierre Tachoire <[email protected]>
+//
+// 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
+
const lp = @import("lightpanda");
-const Factory = @import("../../../Factory.zig");
+
const js = @import("../../../js/js.zig");
-const Node = @import("../../Node.zig");
const Frame = @import("../../../Frame.zig");
+const Factory = @import("../../../Factory.zig");
+
+const Node = @import("../../Node.zig");
const Element = @import("../../Element.zig");
-const HtmlElement = @import("../Html.zig");
const collections = @import("../../collections.zig");
+const HtmlElement = @import("../Html.zig");
+
const TableRow = @This();
pub const Proto = HtmlElement;
diff --git a/src/browser/webapi/element/html/TableSection.zig b/src/browser/webapi/element/html/TableSection.zig
index 7853a7034..55f048d27 100644
--- a/src/browser/webapi/element/html/TableSection.zig
+++ b/src/browser/webapi/element/html/TableSection.zig
@@ -1,13 +1,32 @@
+// Copyright (C) 2023-2026 Lightpanda (Selecy SAS)
+//
+// Francis Bouvier <[email protected]>
+// Pierre Tachoire <[email protected]>
+//
+// 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
+
const lp = @import("lightpanda");
const js = @import("../../../js/js.zig");
+const Frame = @import("../../../Frame.zig");
const Factory = @import("../../../Factory.zig");
+
const Node = @import("../../Node.zig");
-const Frame = @import("../../../Frame.zig");
const Element = @import("../../Element.zig");
-const HtmlElement = @import("../Html.zig");
const collections = @import("../../collections.zig");
+const HtmlElement = @import("../Html.zig");
+
const String = lp.String;
const TableSection = @This();
diff --git a/src/browser/webapi/element/html/TextArea.zig b/src/browser/webapi/element/html/TextArea.zig
index 42431e682..34868058d 100644
--- a/src/browser/webapi/element/html/TextArea.zig
+++ b/src/browser/webapi/element/html/TextArea.zig
@@ -16,22 +16,25 @@
// 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 lp = @import("lightpanda");
const std = @import("std");
+const lp = @import("lightpanda");
+
const js = @import("../../../js/js.zig");
-const Factory = @import("../../../Factory.zig");
const Frame = @import("../../../Frame.zig");
+const Factory = @import("../../../Factory.zig");
const Node = @import("../../Node.zig");
+const Event = @import("../../Event.zig");
const Element = @import("../../Element.zig");
-const HtmlElement = @import("../Html.zig");
-const Form = @import("Form.zig");
const Selection = @import("../../Selection.zig");
-const Event = @import("../../Event.zig");
-const ValidityState = @import("ValidityState.zig");
+
+const HtmlElement = @import("../Html.zig");
const reflection = @import("../reflection.zig");
const text_entry = @import("../text_entry.zig");
+const Form = @import("Form.zig");
+const ValidityState = @import("ValidityState.zig");
+
const TextArea = @This();
pub const Proto = HtmlElement;
diff --git a/src/browser/webapi/element/html/Time.zig b/src/browser/webapi/element/html/Time.zig
index cf1869f90..cf3effcd4 100644
--- a/src/browser/webapi/element/html/Time.zig
+++ b/src/browser/webapi/element/html/Time.zig
@@ -1,8 +1,28 @@
+// Copyright (C) 2023-2026 Lightpanda (Selecy SAS)
+//
+// Francis Bouvier <[email protected]>
+// Pierre Tachoire <[email protected]>
+//
+// 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
+
const lp = @import("lightpanda");
-const Factory = @import("../../../Factory.zig");
+
const js = @import("../../../js/js.zig");
+const Factory = @import("../../../Factory.zig");
+
const Node = @import("../../Node.zig");
const Element = @import("../../Element.zig");
+
const HtmlElement = @import("../Html.zig");
const Time = @This();
diff --git a/src/browser/webapi/element/html/Title.zig b/src/browser/webapi/element/html/Title.zig
index bdc4f8622..277c145d6 100644
--- a/src/browser/webapi/element/html/Title.zig
+++ b/src/browser/webapi/element/html/Title.zig
@@ -1,8 +1,28 @@
+// Copyright (C) 2023-2026 Lightpanda (Selecy SAS)
+//
+// Francis Bouvier <[email protected]>
+// Pierre Tachoire <[email protected]>
+//
+// 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
+
const lp = @import("lightpanda");
-const Factory = @import("../../../Factory.zig");
+
const js = @import("../../../js/js.zig");
+const Factory = @import("../../../Factory.zig");
+
const Node = @import("../../Node.zig");
const Element = @import("../../Element.zig");
+
const HtmlElement = @import("../Html.zig");
const Title = @This();
diff --git a/src/browser/webapi/element/html/UL.zig b/src/browser/webapi/element/html/UL.zig
index e25c8fc7d..412db1105 100644
--- a/src/browser/webapi/element/html/UL.zig
+++ b/src/browser/webapi/element/html/UL.zig
@@ -17,10 +17,13 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
const lp = @import("lightpanda");
-const Factory = @import("../../../Factory.zig");
+
const js = @import("../../../js/js.zig");
+const Factory = @import("../../../Factory.zig");
+
const Node = @import("../../Node.zig");
const Element = @import("../../Element.zig");
+
const HtmlElement = @import("../Html.zig");
const UL = @This();
diff --git a/src/browser/webapi/element/html/Video.zig b/src/browser/webapi/element/html/Video.zig
index 9176fe73b..b9e2b8dcd 100644
--- a/src/browser/webapi/element/html/Video.zig
+++ b/src/browser/webapi/element/html/Video.zig
@@ -17,12 +17,14 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
const lp = @import("lightpanda");
-const Factory = @import("../../../Factory.zig");
+
const js = @import("../../../js/js.zig");
const Frame = @import("../../../Frame.zig");
+const Factory = @import("../../../Factory.zig");
const Node = @import("../../Node.zig");
const Element = @import("../../Element.zig");
+
const Media = @import("Media.zig");
const Video = @This();
diff --git a/src/browser/webapi/element/reflection.zig b/src/browser/webapi/element/reflection.zig
index 970b192c2..31070b0de 100644
--- a/src/browser/webapi/element/reflection.zig
+++ b/src/browser/webapi/element/reflection.zig
@@ -217,23 +217,17 @@ pub fn Reflect(comptime T: type) type {
pub fn double(comptime attr: []const u8, comptime default: f64, comptime positive: bool) js.bridge.Accessor {
const R = struct {
fn get(self: *const T) f64 {
- const value = element(self).getAttributeSafe(.wrap(attr)) orelse return default;
- const parsed = parseFloat(value) orelse return default;
+ const parsed = getDouble(element(self), attr) orelse return default;
if (positive and parsed <= 0) {
return default;
}
return parsed;
}
fn set(self: *T, value: f64, frame: *Frame) !void {
- if (!std.math.isFinite(value)) {
- return error.TypeError;
- }
- if (positive and value <= 0) {
+ if (positive and std.math.isFinite(value) and value <= 0) {
return;
}
- // JS's Number-to-string is the "best representation"
- const str = try (try frame.js.local.?.newNumber(value)).toStringSlice();
- try element(self).setAttributeSafe(.wrap(attr), .wrap(str), frame);
+ try setDouble(element(self), attr, value, frame);
}
};
return bridge.accessor(R.get, R.set, .{ .ce_reactions = true });
@@ -282,6 +276,19 @@ pub fn getLimitedLong(el: *const Element, attr: String) i32 {
return @intCast(parsed);
}
+pub fn getDouble(el: *const Element, comptime attr: []const u8) ?f64 {
+ return parseFloat(el.getAttributeSafe(.wrap(attr)) orelse return null);
+}
+
+pub fn setDouble(el: *Element, comptime attr: []const u8, value: f64, frame: *Frame) !void {
+ if (!std.math.isFinite(value)) {
+ return error.TypeError;
+ }
+ // JS's Number-to-string is the "best representation"
+ const str = try (try frame.js.local.?.newNumber(value)).toStringSlice();
+ try el.setAttributeSafe(.wrap(attr), .wrap(str), frame);
+}
+
fn setInteger(el: *Element, comptime attr: []const u8, value: i64, frame: *Frame) !void {
var buf: [24]u8 = undefined;
const str = std.fmt.bufPrint(&buf, "{d}", .{value}) catch unreachable;