mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-27 06:48:49 +00:00
LibWeb: Add HTML col element span attribute
This commit is contained in:
parent
7e6fc9c26e
commit
01f000acb0
Notes:
sideshowbarker
2024-07-17 11:34:34 +09:00
Author: https://github.com/bplaat
Commit: 01f000acb0
Pull-request: https://github.com/SerenityOS/serenity/pull/22046
4 changed files with 24 additions and 2 deletions
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/HTML/HTMLTableColElement.h>
|
||||
#include <LibWeb/HTML/Numbers.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
|
@ -24,4 +25,22 @@ void HTMLTableColElement::initialize(JS::Realm& realm)
|
|||
set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLTableColElementPrototype>(realm, "HTMLTableColElement"_fly_string));
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/tables.html#dom-colgroup-span
|
||||
unsigned int HTMLTableColElement::span() const
|
||||
{
|
||||
// The span IDL attribute must reflect the content attribute of the same name. It is clamped to the range [1, 1000], and its default value is 1.
|
||||
auto maybe_span_string = get_attribute(HTML::AttributeNames::span);
|
||||
if (maybe_span_string.has_value()) {
|
||||
auto maybe_span = parse_non_negative_integer(maybe_span_string.value());
|
||||
if (maybe_span.has_value())
|
||||
return clamp(maybe_span.value(), 1, 1000);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
WebIDL::ExceptionOr<void> HTMLTableColElement::set_span(unsigned int value)
|
||||
{
|
||||
return set_attribute(HTML::AttributeNames::span, MUST(String::number(value)));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue