question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Setting src on image should kick off request

See original GitHub issue

If I load the following with jsdom, I expect that a request for the image should be kicked off when

<html>
  <head>
  </head>
  <body>
    <script src="http://code.jquery.com/jquery-1.5.min.js"></script>
    <script language="javascript">
      i = new Image();
      i.src = 'http://localhost/favicon.ico';
      console.log(i);
    </script>
  </body>
</html>

I am attempting this with following features:

{features:
    {
      FetchExternalResources: [ 'script', 'img' ],
      ProcessExternalResources: [ 'script', 'img' ],
      MutationEvents: '2.0',
      QuerySelector: false } }

I am not sure if this is the correct behavior or not, but I would expect this work like it works in a browser.

Issue Analytics

  • State:closed
  • Created 12 years ago
  • Comments:30 (19 by maintainers)

github_iconTop GitHub Comments

1reaction
mitarcommented, Jun 30, 2013

What’s with this? It is really bad that new Image() doesn’t work. I use it for decoding to create new Image() and then load image with data URI as src.

0reactions
aaanicommented, Jul 21, 2016

NVM. I nested FetchExternalResources inside features and now it works fine. BTW I am really excited for the new API. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

javascript - Set img src without issuing a request
Any new Image tag with src will result in a request going out from the browser, even if it's just in memory, or...
Read more >
Preloading responsive images - web.dev
This kicks off a request using the same resource selection logic that srcset and sizes will apply. Use cases #. Preloading dynamically-injected ...
Read more >
How to Use HTML5 “picture”, “srcset”, and “sizes” for ...
Start with a Default <img> Element; How to Use “srcset” for a Set of Images; Using “sizes” to Control Image Layout
Read more >
A 4-Minute Guide to the Img src Attribute in HTML
Learn how to use and troubleshoot any issues with the img src attribute in HTML.
Read more >
How To Set Up a React Project with Create React App
This command will kick off a build process that will download the base ... The src/ directory contains the React JavaScript code for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found