Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit d34ad8e

Browse files
committedMar 21, 2025·
LibWeb: Update Element::directionality() for bdi elements to match spec
This fixes three WPT test cases at html/dom/elements/global-attributes/dir-assorted.window.html
1 parent c528c01 commit d34ad8e

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed
 

‎Libraries/LibWeb/DOM/Element.cpp

+12-4
Original file line numberDiff line numberDiff line change
@@ -3275,10 +3275,18 @@ Element::Directionality Element::directionality() const
32753275
// -> undefined
32763276
VERIFY(!maybe_dir.has_value());
32773277

3278-
// FIXME: If element is a bdi element:
3279-
// FIXME: 1. Let result be the auto directionality of element.
3280-
// FIXME: 2. If result is null, then return 'ltr'.
3281-
// FIXME: 3. Return result.
3278+
// If element is a bdi element:
3279+
if (local_name() == HTML::TagNames::bdi) {
3280+
// 1. Let result be the auto directionality of element.
3281+
auto result = auto_directionality();
3282+
3283+
// 2. If result is null, then return 'ltr'.
3284+
if (!result.has_value())
3285+
return Directionality::Ltr;
3286+
3287+
// 3. Return result.
3288+
return result.release_value();
3289+
}
32823290

32833291
// If element is an input element whose type attribute is in the Telephone state:
32843292
if (is<HTML::HTMLInputElement>(this) && static_cast<HTML::HTMLInputElement const&>(*this).type_state() == HTML::HTMLInputElement::TypeAttributeState::Telephone) {

0 commit comments

Comments
 (0)
Please sign in to comment.