- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Should have outputted js from inside noscript tags.
Admin
Well, that's just the programmer fat-fingering the noscript element into the wrong place. And then copying it at 1000 Hz. (Hz, in enterprisey terms, is short-hand for Heinz.)
So it's more of a "What the fat finger" than a real WTF. Be nice if the editor in use worked off a schema, and could therefore catch internal elements with inappropriate tags, but still.
Admin
I'd love to see a test to verify that <noscript> works.
Admin
where exactly was the whitespace added in that? surely they didn't have 'tag1="value1"tag2="value2"' in there?
Admin
As Naegi Makoto once said, no, that's wrong! Look more closely at the
<noscript>
, and particulary at thesrc
:Notice that
ID
in the URL? Well, at the very end of the function theyreturn t.replace("ID",e)+a
, wheree
is a parameter to the function. So, moving the<noscript>
out of the<script>
would leave you with a broken image, so it can't just be a copy-paste mistake.Admin
If you're talking about
<noscript>
in general, it can be tested with browser automation pretty easily! If you're talking about this case, well... the fact that totally broken code got released to production should tell you how much they care about testing XPAdmin
Also worth noting that
t.replace("ID",e)
will replace only the first occurrence, leaving theID
inside thenoscript
element with an incorrect URL. Not that it matters of course, since thatimg
element never gets rendered anyway.Admin
Test parses HTML output. <noscript> is present. Test passed.
Admin
"See also: the Holodecks, which were for the USS Enterprise, and clearly were the buggiest most enterprise piece of software in history." Not that surprising. It is self-modifying code written with 90s practices...
Admin
But that's still just fat-fingering it and also not enclosing the whole thing in a >br<& or a &grdiv<& or something. Granted, you'd have to think a teeny bit about what you're doing, so it's fat-brained as well as fat-fingered, but you probably only need to think it through once, and then rinse, wash and repeat 56,999 times.
Admin
Turn on JavaScript long enough for that part of the code to start then turn it off very quickly before it gets to the noscript.
Admin
Good thing the
<noscript>
will never run, since it wouldn't have the actual ID in the URL. "ID" appears twice in the string, butt.replace("ID",e)
would only replace the first one. You need to pass a regex with ag
flag to replace all. Even if they tested that<noscript>
works, bet they would bother validating that the URL is real.Admin
No. There's no way the
<noscript>
could have been intended to be outside the script block, because thesrc
is nonsense otherwise. If it's outside the script block, reading the URL is enough to make it clear that it's nonsense. It's nothing to do with HTML escaping, and it's nothing to do with mistakenly putting the tag in the wrong place - the way the URL is (supposed to be) constructed makes it clear that the developer intentionally put it there.Admin
Sometimes I get pissed off with React, but then I see other people building HTML fragments with javascript string concatenation, and my world is OK again.
Admin
Oh, I miss those days. Back when web pages were straightforward, they loaded fast, and Javascript did little more than make fancy dropdown menus that anyone concerned with speed or security could easily turn off. Then somewhere along the line, it became all about the "experience", and web sites turned into bloated applications sitting atop a half-baked language that was never intended for that kind of complexity.
Admin
Looks to me like ID part of the URL used to be fixed, and the snippet was just HTML. Someone told a developer to make the ID part variable, so he took the whole block, jammed it into a variable, replaced the URL segment with "ID", and did a string replace. The developer never bothered to think about the pointlessness of doing this to the noscript part, and no one ever tested the noscript behavior, so no one noticed he broke it.
Admin
Sounds like the sort of job to give to a new intern.