MCPcopy
hub / github.com/ZToolsCenter/ZTools / focus

Method focus

resources/zbrowser/client.js:621–629  ·  view source on GitHub ↗

* 聚焦元素 * * @param {string} selector - CSS 选择器 * @returns {ZBrowserClient} this

(selector)

Source from the content-addressed store, hash-verified

619 * @returns {ZBrowserClient} this
620 */
621 focus(selector) {
622 return this.evaluate((selector) => {
623 const el = document.querySelector(selector)
624 if (!el) {
625 throw new Error('focus: unable to find element by selector "' + selector + '"')
626 }
627 el.focus()
628 }, selector)
629 }
630
631 /**
632 * 滚动页面

Callers 15

createDetachedWindowMethod · 0.80
focusByPluginMethod · 0.80
showWindowMethod · 0.80
focusPluginViewMethod · 0.80
killCurrentPluginMethod · 0.80
processPluginModeMethod · 0.80
handlePluginEscMethod · 0.80
createWindowMethod · 0.80
forceActivateWindowMethod · 0.80

Calls 1

evaluateMethod · 0.95

Tested by

no test coverage detected