Explorar o código

Remove the last few potentially buggy uses of `document.querySelector`

Renée Kooi %!s(int64=8) %!d(string=hai) anos
pai
achega
dd01841232

+ 1 - 1
src/plugins/DragDrop/index.js

@@ -123,7 +123,7 @@ module.exports = class DragDrop extends Plugin {
     // }
     // }
 
 
     // onload=${(ev) => {
     // onload=${(ev) => {
-    //   const firstInput = document.querySelector(`${this.target} .UppyDragDrop-focus`)
+    //   const firstInput = this.target.querySelector('.UppyDragDrop-focus')
     //   firstInput.focus()
     //   firstInput.focus()
     // }}
     // }}
 
 

+ 2 - 1
src/plugins/Webcam/CameraScreen.js

@@ -27,7 +27,8 @@ module.exports = (props) => {
   return html`
   return html`
     <div class="UppyWebcam-container" onload=${(el) => {
     <div class="UppyWebcam-container" onload=${(el) => {
       props.onFocus()
       props.onFocus()
-      document.querySelector('.UppyWebcam-recordButton').focus()
+      const recordButton = el.querySelector('.UppyWebcam-recordButton')
+      if (recordButton) recordButton.focus()
     }} onunload=${(el) => {
     }} onunload=${(el) => {
       props.onStop()
       props.onStop()
     }}>
     }}>

+ 1 - 16
src/uppy-base/src/plugins/Webcam.js

@@ -177,7 +177,6 @@ module.exports = class Webcam {
         }
         }
       }
       }
       delete this.stream
       delete this.stream
-      delete this.video
     }
     }
 
 
     if (this.userMedia !== true) {
     if (this.userMedia !== true) {
@@ -246,7 +245,7 @@ module.exports = class Webcam {
    * Stops the webcam capture and video playback.
    * Stops the webcam capture and video playback.
    */
    */
   stop () {
   stop () {
-    let { video, videoStream } = this
+    let { videoStream } = this
 
 
     this.updateState({
     this.updateState({
       cameraReady: false
       cameraReady: false
@@ -262,20 +261,6 @@ module.exports = class Webcam {
       videoStream.onended = null
       videoStream.onended = null
       videoStream = null
       videoStream = null
     }
     }
-
-    if (video) {
-      video.onerror = null
-      video.pause()
-
-      if (video.mozSrcObject) {
-        video.mozSrcObject = null
-      }
-
-      video.src = ''
-    }
-
-    this.video = document.querySelector('.UppyWebcam-video')
-    this.canvas = document.querySelector('.UppyWebcam-canvas')
   }
   }
 
 
   flashNotify (type, msg) {
   flashNotify (type, msg) {