From e7dc0efa7735b88877e052fcd12db2a42c3de79c Mon Sep 17 00:00:00 2001 From: ldm0 Date: Wed, 2 Sep 2026 01:45:42 +0800 Subject: [PATCH] fix(selectors): resolve clean textarea directionality --- moli-selector/src/lib.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/moli-selector/src/lib.rs b/moli-selector/src/lib.rs index 67fc203c42..e6af35c4db 100644 --- a/moli-selector/src/lib.rs +++ b/moli-selector/src/lib.rs @@ -1733,11 +1733,21 @@ mod tests { let textarea = host.create_element("textarea"); assert!(host.set_attribute(textarea, "dir", "auto")); - assert!(host.set_input_value(textarea, "\u{05ea}")); + let textarea_text = host.create_text_node("\u{05ea}"); + assert!(host.append_child(textarea, textarea_text)); assert!(host.append_child(body, textarea)); assert!(!engine.matches_host(&host, textarea, ":dir(ltr)").unwrap()); assert!(engine.matches_host(&host, textarea, ":dir(rtl)").unwrap()); + assert!(host.set_text_content(textarea, "A")); + assert!(engine.matches_host(&host, textarea, ":dir(ltr)").unwrap()); + assert!(!engine.matches_host(&host, textarea, ":dir(rtl)").unwrap()); + + assert!(host.set_input_value(textarea, "\u{05ea}")); + assert!(host.set_text_content(textarea, "A")); + assert!(!engine.matches_host(&host, textarea, ":dir(ltr)").unwrap()); + assert!(engine.matches_host(&host, textarea, ":dir(rtl)").unwrap()); + assert!(host.set_input_value(textarea, "A")); assert!(engine.matches_host(&host, textarea, ":dir(ltr)").unwrap()); assert!(!engine.matches_host(&host, textarea, ":dir(rtl)").unwrap());