mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 15:48:12 +00:00
LibWeb: Add HTML col element span attribute
This commit is contained in:
parent
7e6fc9c26e
commit
01f000acb0
4 changed files with 24 additions and 2 deletions
|
@ -9,7 +9,7 @@ interface HTMLMetaElement : HTMLElement {
|
|||
[CEReactions, Reflect] attribute DOMString name;
|
||||
[CEReactions, Reflect=http-equiv] attribute DOMString httpEquiv;
|
||||
[CEReactions, Reflect] attribute DOMString content;
|
||||
// FIXME: [CEReactions] attribute DOMString media;
|
||||
[CEReactions, Reflect] attribute DOMString media;
|
||||
|
||||
// Obsolete
|
||||
[CEReactions, Reflect] attribute DOMString scheme;
|
||||
|
|
|
@ -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)));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -17,6 +17,9 @@ class HTMLTableColElement final : public HTMLElement {
|
|||
public:
|
||||
virtual ~HTMLTableColElement() override;
|
||||
|
||||
unsigned span() const;
|
||||
WebIDL::ExceptionOr<void> set_span(unsigned);
|
||||
|
||||
private:
|
||||
HTMLTableColElement(DOM::Document&, DOM::QualifiedName);
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ interface HTMLTableColElement : HTMLElement {
|
|||
|
||||
[HTMLConstructor] constructor();
|
||||
|
||||
// FIXME: [CEReactions] attribute unsigned long span;
|
||||
[CEReactions] attribute unsigned long span;
|
||||
|
||||
// Obsolete
|
||||
[CEReactions, Reflect] attribute DOMString align;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue