javascript - What is the predefined focus() function that is available in Chrome? -
javascript - What is the predefined focus() function that is available in Chrome? -
today run unexpected when writing javascript in chrome (version 37). appears chrome has predefined focus variable available global. upon farther inspection via developer tools, i've found variable function:
> typeof focus "function" does know function or does, or why global?
i had variable named focus , global messed in webapp. spent lastly hr debugging focus getting created , turned out chrome had predefined.
you talking
window.focus
makes request bring window front. may fail due user settings , window isn't guaranteed frontmost before method returns.
it built-in function, not reserved word open not name variable. other baddie naming submit button submit , trying submit form programatically
any variable defined in global scope may mess other window.xxxx vars/functions.
more window functions.
javascript google-chrome predefined-variables
Comments
Post a Comment