mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-12-16 00:08:59 +00:00
Correct exception on custom element re-definition
This commit is contained in:
@@ -51,7 +51,8 @@ pub fn define(self: *CustomElementRegistry, name: []const u8, constructor: js.Fu
|
||||
|
||||
const gop = try self._definitions.getOrPut(page.arena, name);
|
||||
if (gop.found_existing) {
|
||||
return error.AlreadyDefined;
|
||||
// Yes, this is the correct error to return when trying to redefine a name
|
||||
return error.NotSupported;
|
||||
}
|
||||
|
||||
const owned_name = try page.dupeString(name);
|
||||
|
||||
@@ -47,7 +47,7 @@ pub fn getName(self: *const DOMException) []const u8 {
|
||||
.invalid_character_error => "InvalidCharacterError",
|
||||
.syntax_error => "SyntaxError",
|
||||
.not_found => "NotFoundError",
|
||||
.not_supported => "NotSupported",
|
||||
.not_supported => "NotSupportedError",
|
||||
.hierarchy_error => "HierarchyError",
|
||||
};
|
||||
}
|
||||
|
||||
@@ -74,12 +74,7 @@ pub fn init(callback: js.Function, options: ?ObserverInit, page: *Page) !*Inters
|
||||
.array => |arr| try page.arena.dupe(f64, arr),
|
||||
};
|
||||
|
||||
return page._factory.create(IntersectionObserver{
|
||||
._callback = callback,
|
||||
._root = opts.root,
|
||||
._root_margin = root_margin,
|
||||
._threshold = threshold
|
||||
});
|
||||
return page._factory.create(IntersectionObserver{ ._callback = callback, ._root = opts.root, ._root_margin = root_margin, ._threshold = threshold });
|
||||
}
|
||||
|
||||
pub fn observe(self: *IntersectionObserver, target: *Element, page: *Page) !void {
|
||||
|
||||
@@ -14,7 +14,6 @@ pub fn init(page: *Page) !*Headers {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
pub fn append(self: *Headers, name: []const u8, value: []const u8, page: *Page) !void {
|
||||
try self._list.append(page.arena, name, value);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user