diff --git a/plugins/behaviors/filechooser/Open.js b/plugins/behaviors/filechooser/Open.js index 17e47bbdd6..c5c4e1c06b 100644 --- a/plugins/behaviors/filechooser/Open.js +++ b/plugins/behaviors/filechooser/Open.js @@ -1,7 +1,6 @@ // Note: Not working in iOS9+ import CreateFileInput from './CreateFileInput.js'; -import Click from '../../gameobjects/dom/filechooser/Click.js'; import ClickPromise from '../../gameobjects/dom/filechooser/ClickPromise.js'; const GetValue = Phaser.Utils.Objects.GetValue; @@ -11,7 +10,7 @@ var Open = function (game, config) { // game: game, scene, or game object var closeDelay = GetValue(config, 'closeDelay', 200); var fileInput = CreateFileInput(game, config); - Click(fileInput); + fileInput.click(); return ClickPromise({ game, fileInput, closeDelay }) .then(function (result) { RemoveFromDOM(fileInput); diff --git a/plugins/gameobjects/dom/filechooser/Click.js b/plugins/gameobjects/dom/filechooser/Click.js deleted file mode 100644 index 4fea652e76..0000000000 --- a/plugins/gameobjects/dom/filechooser/Click.js +++ /dev/null @@ -1,16 +0,0 @@ -var Click = function (fileInput) { - if (fileInput.click) { - fileInput.click(); - - } else { - try { - var event = new Event('Event', { bubbles: true, cancelable: true }); - fileInput.dispatchEvent(event); - } catch (e) { - console.log(e); - } - - } -} - -export default Click; \ No newline at end of file diff --git a/plugins/gameobjects/dom/filechooser/FileChooser.js b/plugins/gameobjects/dom/filechooser/FileChooser.js index 21a0c2584e..6f6d031d6e 100644 --- a/plugins/gameobjects/dom/filechooser/FileChooser.js +++ b/plugins/gameobjects/dom/filechooser/FileChooser.js @@ -1,7 +1,6 @@ import Resize from '../utils/Resize.js'; import SyncTo from '../utils/SyncTo.js'; import LoadFileMethods from '../utils/LoadFileMethods.js'; -import Click from './Click.js'; import ClickPromose from './ClickPromise.js'; const DOMElement = Phaser.GameObjects.DOMElement; @@ -96,7 +95,7 @@ class FileChooser extends DOMElement { } open() { // Only work under any touch event - Click(this.fileInput); + this.fileInput.click(); return this; }