Skip to main content

dom_focus

Function dom_focus 

Source
pub fn dom_focus(
    it: &mut Interp,
    this: Value,
    _a: &[Value],
) -> Result<Value, Value>
Expand description

element.focus()(HTML5。丸ごと未対応だった。document.activeElement と対になる書き込み側。以前は scrollIntoView と同じ no-op で document.activeElement が常に null 固定になっていた)。DomBridge:: focused_idx を直接更新し、仕様どおりの順序(旧要素の blur/ focusout → 新要素の focus/focusin)でイベントを発火する。レンダラ側 の WebEngine::focused_id(実クリック/autofocus 用の文字列キー版状態) との同期は対象外(詳細は DomBridge::focused_idx のコメント参照)。