1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 15:34:58 +00:00

LibWeb: Move DOMException from DOM/ to WebIDL/

This commit is contained in:
Linus Groh 2022-09-25 17:28:46 +01:00
parent ad04d7ac9b
commit bbaa05fcf9
49 changed files with 206 additions and 203 deletions

View file

@ -4,12 +4,12 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/DOM/DOMException.h>
#include <LibWeb/HTML/HTMLOptGroupElement.h>
#include <LibWeb/HTML/HTMLOptionElement.h>
#include <LibWeb/HTML/HTMLOptionsCollection.h>
#include <LibWeb/HTML/HTMLSelectElement.h>
#include <LibWeb/HTML/Window.h>
#include <LibWeb/WebIDL/DOMException.h>
namespace Web::HTML {
@ -40,11 +40,11 @@ WebIDL::ExceptionOr<void> HTMLOptionsCollection::add(HTMLOptionOrOptGroupElement
// 1. If element is an ancestor of the select element on which the HTMLOptionsCollection is rooted, then throw a "HierarchyRequestError" DOMException.
if (resolved_element->is_ancestor_of(root()))
return DOM::HierarchyRequestError::create(global_object(), "The provided element is an ancestor of the root select element.");
return WebIDL::HierarchyRequestError::create(global_object(), "The provided element is an ancestor of the root select element.");
// 2. If before is an element, but that element isn't a descendant of the select element on which the HTMLOptionsCollection is rooted, then throw a "NotFoundError" DOMException.
if (before_element && !before_element->is_descendant_of(root()))
return DOM::NotFoundError::create(global_object(), "The 'before' element is not a descendant of the root select element.");
return WebIDL::NotFoundError::create(global_object(), "The 'before' element is not a descendant of the root select element.");
// 3. If element and before are the same element, then return.
if (before_element && (resolved_element.ptr() == before_element.ptr()))