mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-10 01:59:31 +00:00
LibWeb: Stub out HTMLElement.outerText
This commit is contained in:
parent
e610346fab
commit
4cc972a8ae
Notes:
sideshowbarker
2024-07-17 06:51:10 +09:00
Author: https://github.com/awesomekling
Commit: 4cc972a8ae
Pull-request: https://github.com/SerenityOS/serenity/pull/23964
3 changed files with 31 additions and 2 deletions
|
@ -146,8 +146,18 @@ void HTMLElement::set_inner_text(StringView text)
|
|||
set_needs_style_update(true);
|
||||
}
|
||||
|
||||
String HTMLElement::inner_text()
|
||||
// https://html.spec.whatwg.org/multipage/dom.html#the-innertext-idl-attribute:dom-outertext-2
|
||||
WebIDL::ExceptionOr<void> HTMLElement::set_outer_text(String)
|
||||
{
|
||||
dbgln("FIXME: Implement HTMLElement::set_outer_text()");
|
||||
return {};
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/dom.html#get-the-text-steps
|
||||
String HTMLElement::get_the_text_steps()
|
||||
{
|
||||
// FIXME: Implement this according to spec.
|
||||
|
||||
StringBuilder builder;
|
||||
|
||||
// innerText for element being rendered takes visibility into account, so force a layout and then walk the layout tree.
|
||||
|
@ -169,6 +179,20 @@ String HTMLElement::inner_text()
|
|||
return MUST(builder.to_string());
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/dom.html#dom-innertext
|
||||
String HTMLElement::inner_text()
|
||||
{
|
||||
// The innerText and outerText getter steps are to return the result of running get the text steps with this.
|
||||
return get_the_text_steps();
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/dom.html#dom-outertext
|
||||
String HTMLElement::outer_text()
|
||||
{
|
||||
// The innerText and outerText getter steps are to return the result of running get the text steps with this.
|
||||
return get_the_text_steps();
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/cssom-view-1/#dom-htmlelement-offsetparent
|
||||
JS::GCPtr<DOM::Element> HTMLElement::offset_parent() const
|
||||
{
|
||||
|
|
|
@ -42,6 +42,9 @@ public:
|
|||
String inner_text();
|
||||
void set_inner_text(StringView);
|
||||
|
||||
[[nodiscard]] String outer_text();
|
||||
WebIDL::ExceptionOr<void> set_outer_text(String);
|
||||
|
||||
int offset_top() const;
|
||||
int offset_left() const;
|
||||
int offset_width() const;
|
||||
|
@ -87,6 +90,8 @@ private:
|
|||
virtual JS::GCPtr<DOM::EventTarget> global_event_handlers_to_event_target(FlyString const&) override { return *this; }
|
||||
virtual void did_receive_focus() override;
|
||||
|
||||
[[nodiscard]] String get_the_text_steps();
|
||||
|
||||
JS::GCPtr<DOMStringMap> m_dataset;
|
||||
|
||||
enum class ContentEditableState {
|
||||
|
|
|
@ -26,7 +26,7 @@ interface HTMLElement : Element {
|
|||
// FIXME: [CEReactions] attribute DOMString autocapitalize;
|
||||
|
||||
[LegacyNullToEmptyString, CEReactions] attribute DOMString innerText;
|
||||
// FIXME: [LegacyNullToEmptyString, CEReactions] attribute DOMString outerText;
|
||||
[LegacyNullToEmptyString, CEReactions] attribute DOMString outerText;
|
||||
|
||||
// FIXME: ElementInternals attachInternals();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue