LibWeb: Update Element::directionality() for bdi elements to match spec
Some checks are pending
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run

This fixes three WPT test cases at html/dom/elements/global-attributes/dir-assorted.window.html

Update test expectations for Tests/LibWeb/Text/expected/wpt-import/css/selectors/dir-pseudo-on-bdi-element.txt
This commit is contained in:
Noah 2025-03-20 21:53:14 -07:00 committed by Jelle Raaijmakers
commit add380d6e2
Notes: github-actions[bot] 2025-03-23 08:59:37 +00:00
2 changed files with 15 additions and 8 deletions

View file

@ -3291,10 +3291,18 @@ Element::Directionality Element::directionality() const
// -> undefined // -> undefined
VERIFY(!maybe_dir.has_value()); VERIFY(!maybe_dir.has_value());
// FIXME: If element is a bdi element: // If element is a bdi element:
// FIXME: 1. Let result be the auto directionality of element. if (local_name() == HTML::TagNames::bdi) {
// FIXME: 2. If result is null, then return 'ltr'. // 1. Let result be the auto directionality of element.
// FIXME: 3. Return result. auto result = auto_directionality();
// 2. If result is null, then return 'ltr'.
if (!result.has_value())
return Directionality::Ltr;
// 3. Return result.
return result.release_value();
}
// If element is an input element whose type attribute is in the Telephone state: // If element is an input element whose type attribute is in the Telephone state:
if (is<HTML::HTMLInputElement>(this) && static_cast<HTML::HTMLInputElement const&>(*this).type_state() == HTML::HTMLInputElement::TypeAttributeState::Telephone) { if (is<HTML::HTMLInputElement>(this) && static_cast<HTML::HTMLInputElement const&>(*this).type_state() == HTML::HTMLInputElement::TypeAttributeState::Telephone) {

View file

@ -2,10 +2,9 @@ Harness status: OK
Found 5 tests Found 5 tests
3 Pass 5 Pass
2 Fail Pass bdi element without dir content attribute
Fail bdi element without dir content attribute Pass bdi element with invalid dir content attribute
Fail bdi element with invalid dir content attribute
Pass bdi element with dir=auto content attribute Pass bdi element with dir=auto content attribute
Pass bdi element with dir=ltr content attribute Pass bdi element with dir=ltr content attribute
Pass bdi element with dir=rtl content attribute Pass bdi element with dir=rtl content attribute