diff options
| author | Julien Mougenot <jum@odoo.com> | 2020-02-25 12:52:41 +0000 |
|---|---|---|
| committer | Julien Mougenot <jum@odoo.com> | 2020-03-13 09:37:29 +0000 |
| commit | 384e516218375000461aa3fcb0ac1b9eaa960fb3 (patch) | |
| tree | 89d6faece5edea9a4f182b7a6d2e83cbb6f540ce /addons/web/static/src/js/core | |
| parent | 11ba58a311311b798a68183df18673e562bb97d3 (diff) | |
[REF] web: Update generic files
General cleaning of some helpers and generic files. The idea is that they are
less likely to be entirely re-written in the near future so this is a way to
keep the code clean, readable and compliant to the current standards. Changes include:
- Use of async/await when possible
- Use of const/let instead of var
- Removal of underscore.js
- Use of native JS instead of jQuery when possible
The logic of the affected code remains the same.
Diffstat (limited to 'addons/web/static/src/js/core')
| -rw-r--r-- | addons/web/static/src/js/core/custom_hooks.js | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/addons/web/static/src/js/core/custom_hooks.js b/addons/web/static/src/js/core/custom_hooks.js index c196dd7f900..69750066a8c 100644 --- a/addons/web/static/src/js/core/custom_hooks.js +++ b/addons/web/static/src/js/core/custom_hooks.js @@ -14,18 +14,18 @@ odoo.define('web.custom_hooks', function () { */ function useFocusOnUpdate() { const component = Component.current; - component.__willFocus = null; + let willFocus = null; function _focusSelector() { - if (component.__willFocus) { - const target = component.el.querySelector(component.__willFocus); + if (willFocus) { + const target = component.el.querySelector(willFocus); if (target) { target.focus(); if (['INPUT', 'TEXTAREA'].includes(target.tagName)) { target.selectionStart = target.selectionEnd = target.value.length; } } - component.__willFocus = null; + willFocus = null; } } @@ -33,7 +33,7 @@ odoo.define('web.custom_hooks', function () { onPatched(_focusSelector); return function focusOnUpdate(selector = '[autofocus]') { - component.__willFocus = selector; + willFocus = selector; }; } |
