| Index: ui/file_manager/file_manager/foreground/js/file_manager_commands.js
|
| diff --git a/ui/file_manager/file_manager/foreground/js/file_manager_commands.js b/ui/file_manager/file_manager/foreground/js/file_manager_commands.js
|
| index 7f035d219d3e22983a6b55f4c69e72b0b43dc095..662c39f9f30550af197d0416e2185bdd2a254216 100644
|
| --- a/ui/file_manager/file_manager/foreground/js/file_manager_commands.js
|
| +++ b/ui/file_manager/file_manager/foreground/js/file_manager_commands.js
|
| @@ -276,8 +276,11 @@ CommandHandler.prototype.updateAvailability = function() {
|
| * @private
|
| */
|
| CommandHandler.prototype.shouldIgnoreEvents_ = function() {
|
| - // Do not handle commands, when a dialog is shown.
|
| - if (this.fileManager_.document.querySelector('.cr-dialog-container.shown'))
|
| + // Do not handle commands, when a dialog is shown. Do not use querySelector
|
| + // as it's much slower, and this method is executed often.
|
| + var dialogs = this.fileManager_.document.getElementsByClassName(
|
| + 'cr-dialog-container');
|
| + if (dialogs.length !== 0 && dialogs[0].classList.contains('shown'))
|
| return true;
|
|
|
| return false; // Do not ignore.
|
|
|