title: Get the clicked element inside webview in electron
body: <p>I'm building an electron app with a webview embedded in it. Just like this.</p>
  
  <h3>index.html</h3>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
    &lt;meta charset="UTF-8"&gt;
    &lt;title&gt;Hello World!&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;webview
        id="webview"
        src="https://www.google.com/search?q=search&amp;tbm=isch"
    /&gt;
    &lt;script&gt;
      require('./renderer.js')
    &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I would like to get the tagName of the element on which the user right-clicked, and I want to do something with the element if it's <code>img</code>. Here's what I tried.</p>
  
  <h3>renderer.js</h3>
  
  <pre><code>document.getElementById("webview").addEventListener("contextmenu", event =&gt; {
    if (event.target.tagName === "img") {
      const src = event.target.src;
      // do something with src
    }
  });
  </code></pre>
  
  <p>It doesn't work, because <code>event.target</code> is always the embedded <code>webview</code> itself. No matter what I clicked. How to make it work?</p>