Closed Bug 342299 Opened 13 years ago Closed 13 years ago

An image inside a noscript tag is loaded when using XHTML 1.1 and Content-type is "application/xhtml+xml"


(Core :: HTML: Parser, defect)

Not set





(Reporter: asilgag, Assigned: mrbkap)




(Keywords: testcase)


(1 file)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; eu; rv: Gecko/20060508 Firefox/
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; eu; rv: Gecko/20060508 Firefox/

We have an image inside a noscript tag. When the page is served using "Content-type: application/xhtml+xml", the image inside the <noscript> tag is not showed, but Firefox actually loads it in the background, resulting in a hit in the server. The noscript tag is used in a stats counter system, so it produces 2 hits in the counter. Visit for a real example.

This is the JavaScript code and the noscript tag we use:

<div id="control-tags">
<script type="text/javascript">
var IVW="";
var i = document.createElementNS("","img");
<div><img src="" alt="" /></div>
So the above code produces two hits in the stats counter system: first, the JavaScript hit, and second, the <noscript> tag hit.

Reproducible: Always

Steps to Reproduce:
1.Put an image inside a noscript tag in an XHTML 1.1 page served with "Content-type: application/xhtml+xml" by the web server
2.The image is not showed in the browser, but it is actually loaded
3.It produces a hit in the server, although the image is inside a noscript tag

Actual Results:  
The image is loaded, but not showed, and it produces a hit in the web server

Expected Results:  
The image should not be loaded, because it is inside a noscript tag and the browser has JavaScript enabled

Visit for a real example of the problem. It is a XHTML 1.1 page, served with content-type "application/xhtml+xml", and it loads the imagen two times.
Component: General → Layout
Product: Firefox → Core
QA Contact: general → layout
Version: unspecified → 1.8 Branch
Attached file testcase
Do you get an alert with this testcase?
I don't get an alert with the testcase.
In the testcase you have done I don't get any alert, because the testcase Content-type is text/html, and the problem only occurs when the Content-type is "application/xhtml+xml".

In I have the same testcase you have done, but with a "Content-type: application/xhtml+xml", and I do get an alert message with the "loaded" text. See (which is served with the correct Content-type from the server)
Ah, sorry, I'm an idiot, I didn't read too well.
In text/html, the contents of <noscript> are text, no dom is created.

In application/xhtml+xml, the content of <noscript> is generated as a dom, since we're talking about xml here.

See the code where this happens:

So I think this bug is invalid.
Assignee: nobody → mrbkap
Component: Layout → HTML: Parser
Keywords: testcase
OS: Linux → All
QA Contact: layout → parser
Version: 1.8 Branch → Trunk
Ok, it makes sense that the image inside the <noscript> is loaded when it's generated as a dom.

But this breaks some user track systems, like the one we use. I understand the parser is treating the <noscript> tag correctly, loading its contents as is generated as a dom, but therefore I can't avoid loading an image or resource from the server when I want to provide an alternative for non-javascript browsers.

Perhaps a web developer would expect that the elements inside a <noscript> tag aren't loaded from the server when the UA has JavaScript enabled. If this is the correct behavior, consider this bug as invalid and close it.

Thanks a lot!
The noscript tag has display: none css rule, which is why it is invisible when scripts are working.
In application/xhtml+xml, the contents of the noscript tag need to be build up as a dom, because that's a requirement of xml (I don't know where to find that's a requirement, though).
The content of display:none elements still get loaded (iframe, img, etc), this is necessary to not break the web, afaik.

html4.01 spec of noscript:
They only talk about not rendering of the content, which is what Mozilla is doing.
the whatwg is not saying anything yet:

So what Mozilla is doing in xml mode is probably correct, and what it is doing in html mode (by treating the content of noscript tags as text) is probably a quirk, to not break the web.
Ok, thanks for the explanation, you can consider the bug as invalid, so I close it. Thanks a lot!
Closed: 13 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.