Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Why Firefox fetch source of image if <img> is inside <template>?

  • 16 replies
  • 1 has this problem
  • 57 views
  • Last reply by remek

more options

Sources of images inside <template> shouldn't be fetch. I do not observed this kind of behavior in chromium which is correct in my opinion. I hold in <template> javascript template literals strings mixed into html code for further html generation from json objects recieved from api. A 'src' attribute holds something like `${object.source ? object.source : }` and firefox thinks he should look up for this thing in the internet. Is this behavior demanded or overlooked?

Using Firefox Quantum 61.0 (64-bit) for GNU/Linux.

ps. sorry if I missplaced this question but I find this site to be extremely unintuitive.

Sources of images inside <template> shouldn't be fetch. I do not observed this kind of behavior in chromium which is correct in my opinion. I hold in <template> javascript template literals strings mixed into html code for further html generation from json objects recieved from api. A 'src' attribute holds something like `${object.source ? object.source : ''}` and firefox thinks he should look up for this thing in the internet. Is this behavior demanded or overlooked? Using Firefox Quantum 61.0 (64-bit) for GNU/Linux. ps. sorry if I missplaced this question but I find this site to be extremely unintuitive.

Chosen solution

This might be a good place to raise the issue:

https://discourse.mozilla.org/c/firefox-development

Read this answer in context 👍 1

All Replies (16)

more options

Please supply the URL or the whole piece of code, URL would be best.

more options

Dunno how to place sample code here

Modified by remek

more options

remek said

<template> </template> Dunno how to place sample code here

Need the code between the two can use Edit to the right to change the post. As mentioned URL would be best. Upload your HTML & CSS to here to see if your code passes : HTML https://validator.w3.org/ CSS https://jigsaw.w3.org/css-validator/

more options

Just create template tag inside body and img inside template with src="anything". Then proceede to the site with this code and type ctrl-shift-e and then ctrl-shift-r and 404 GET will show up. WHY? img inside <template> should be ignored and not requested.

Modified by remek

more options

Find out what W3C has to say, usually it will mention how to fix it or if it can belong there.

more options

I am afraid I cannot provide URL but I think it is a simple question that not require a code or URL. Why firefox parse img tag inside template tag. Is it on purpose? Why is it on purpose? Is it a bug?

Modified by remek

more options

Not find anything on this topic on net. Otherwise I will not even bother to ask for answers here.

more options

As mentioned upload it. Is it HTML5 is it HTML5 Responsive, Is HTML 4.0, 4.0.1 Transitional. With out knowing it maybe allowed or maybe not. Also we are not teaching coding.

more options

HTML5. I am not asking for teachings. Rather answers from firefox developers on this behavior. Not sure if it is correct place for this.

Behavior: Firefox parse img tag inside template tag and try fetch for value of src attribute. Question: Is this behavior correct and why? Reason: Chromium doesn't fetch img tag inside template tag. I think this behavior is most wanted.

Modified by remek

more options

the address for local is file:// https://www.w3schools.com/tags/tag_template.asp

more options

Well... somebody is more oriented on this topic? Or can guide me where I can ask this question directly to developers?

more options

I've never used the template tag. I see documentation here:

https://developer.mozilla.org/docs/Web/HTML/Element/template

It says:

While the parser does process the contents of the <template> element while loading the page, it does so only to ensure that those contents are valid; the element's contents are not rendered, however.

The word "process" is ambiguous, but I do see an image retrieval when running this Fiddle in Firefox:

https://jsfiddle.net/yom70axn/1/

And not in Chrome (on Windows).

Is there a standard which says what should happen with inline images?

I think this probably is beyond the purview of this support forum.

more options

Yes. In my opinion the image should not be retrieve. How suggest this to developers?

more options

There is no standard I think for this. It is extremely difficult to find anything related this topic. But templates are used for.... templates. Theirs values are empty until filled and append to DOM.

more options

Chosen Solution

This might be a good place to raise the issue:

https://discourse.mozilla.org/c/firefox-development

more options

Thank You I much appreciate yours answers!