Coverage Report

Created: 2025-03-04 07:22

/src/serenity/Userland/Libraries/LibWeb/HTML/HTMLLIElement.cpp
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Copyright (c) 2020, the SerenityOS developers.
3
 *
4
 * SPDX-License-Identifier: BSD-2-Clause
5
 */
6
7
#include <LibWeb/Bindings/HTMLLIElementPrototype.h>
8
#include <LibWeb/HTML/HTMLLIElement.h>
9
#include <LibWeb/HTML/Numbers.h>
10
#include <LibWeb/HTML/Window.h>
11
12
namespace Web::HTML {
13
14
JS_DEFINE_ALLOCATOR(HTMLLIElement);
15
16
HTMLLIElement::HTMLLIElement(DOM::Document& document, DOM::QualifiedName qualified_name)
17
0
    : HTMLElement(document, move(qualified_name))
18
0
{
19
0
}
20
21
0
HTMLLIElement::~HTMLLIElement() = default;
22
23
void HTMLLIElement::initialize(JS::Realm& realm)
24
0
{
25
0
    Base::initialize(realm);
26
0
    WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLLIElement);
27
0
}
28
29
// https://html.spec.whatwg.org/multipage/grouping-content.html#dom-li-value
30
WebIDL::Long HTMLLIElement::value()
31
0
{
32
    // The value IDL attribute must reflect the value of the value content attribute.
33
    // NOTE: This is equivalent to the code that would be generated by the IDL generator if we used [Reflect] on the value attribute.
34
    //       We don't do that in this case, since this method is used elsewhere.
35
0
    auto content_attribute_value = get_attribute(AttributeNames::value).value_or("0"_string);
36
0
    if (auto maybe_number = HTML::parse_integer(content_attribute_value); maybe_number.has_value())
37
0
        return *maybe_number;
38
0
    return 0;
39
0
}
40
41
}