• doubting_poster (unregistered)

    So the WTF is linking to cache urls? or is there something else going on?

  • giammin (unregistered)

    last 6 are the same image

  • Ashamed (unregistered)

    ...authored by "the other junior dev."

  • wtf (unregistered)

    The Real WTF is the write up of this article not pointing out the real WTF.

  • Raj (unregistered)

    If his first app was using bootstrap CSS, then he's still a junior as we speak.

  • iWantToKeepAnon (unregistered)

    Right, because when I see "col-sm-6" I always search for "randomClass". :-?

    It explained why, for the past several years, new images on the site had randomly not worked for any discernible reason

    Because "make-short" contained a random display: hidden? Because $("img...") replaced the image? Dumb this down for a non jQuery guy.

  • What? (unregistered)

    What this post doesn't clearly explain;

    • What is meant by "col-sm-6 appearing on the form"? As visible text? As applied CSS?
    • How you got from "col-sm-6" to "he ran a project-wide search for the randomClass"? Where's the connection?
    • Why "the site had randomly not worked for any discernible reason"?

    We can see amazon caching going on and could reasonably hypothesize that the cache IDs are temporary. We're also assuming that we know what the class "make-short" does. Possibly "display: none"? The article doesn't explain...and I am a CSS guy.

    @Author, there's some clean up to be done...

  • Moderate in moderation (unregistered)

    TRWTF is this article.

  • Newbie to php (unregistered)

    I don’t understand this WTF.

  • I dunno LOL ¯\(°_o)/¯ (unregistered) in reply to giammin

    Last six are also the same image as the first one!

    I still have no idea what the point was, but deep-linking to arbitrary image URLs in an Amazon AWS cache is definitely a WTF.

  • Brian Boorman (google)

    I tried one of the image. Received a 403 response code.

    The website declined to show this webpage

    HTTP 403

  • I Am A Robot (unregistered)

    No, it doesn't explain why.

  • Ray (unregistered)

    This doesn't explain anything, we don't know what the 'make-short' class is, the 'randomClass' and 'otherRandomClass' are set up only for small screens (hence the "col-sm" class) which means they'll show just fine on screens larger than 570px, and there's a stack of images which seem to be very similar and are pointing to links that may or may not exist.

    I would say the article itself is the WTF, not the contents of it.

  • Kirit (unregistered)

    If you cant explain why something is a WTF, please don't bother posting it.

    For the benefit of all those who feel their lack of jQuery knowledge is preventing them understand this post, ill attempt to describe the code: When the page (DOM) finishes loading (this will probably run on any page on the site)

    1. find all elements with the class 'randomClass' and add the class 'col-sm-6'
    2. find all elements with the class 'otherRandomClass' and add the class 'col-sm-12'
    3. find all image elements with specific src attribute values and add the class 'make-short'

    That is all.

    While this code certainly has a smell, I fail to see the WTF. for the 10+ years that ive been a daily WTF-er, this is the first time that a post has let me down. I feel like I wont get back the 5 minutes of my life I have wasted trying to find the missing WTF in this post.

    I feel pretty empty and let down.

  • 🤷 (unregistered)

    Yes, without further explanation the WTF remains very unclear. I mean, of course it's pretty WTF-y to include the same image 7 times and link to a cache directory on amazonaws. But this doesn't explain why "new images on the site had randomly not worked", nor does it explain, why someone would run a project wide search for "randomClass" when trying to figure out how "col-sm-6" is defined.

  • Merus (unregistered)

    I am not sure how I'm gasping at the WTF and coming to the comments and seeing a bunch of unimpressed commenters. I mean, for starters instead of setting 'col-sm-6' as a class, a pretty typical Bootstrap 3 layout class for a div, the page uses 'randomClass' as a class, and then the JavaScript... adds 'col-sm-6'? Instead of just putting that as a class on the div where it'd be meaningful for layout?

    And then it starts giving a bunch of img tags the 'make-short' class, which doesn't appear to be part of a framework, but it's inexplicably doing it by image location instead of a normal choice like 'class', or 'images contained in a div with a particular class'. Presumably it's doing it for every image the author knew existed on the site at the time this script was written. Like the previous lines, it's modifying the HTML on the client side after it's been rendered, with classes that... could very easily have been added when the HTML was generated on the server side.

    So this JavaScript, in its entirety, adds meaningful layout classes on the client side, using very poorly chosen selectors, when it didn't need to be done client side. That's spectacular.

  • blink stare blink (unregistered)

    There are a few obvious WTF bits here. And yeah "the other dev did this" .. Yep. Sure. Sure they did.

  • Ulysses (unregistered)

    Yeah, this article is truly TRWTF. The submitter and/or Mrs. 'Editor' leapt from one fact to another and left the reader out to dry. One's level of jQuery familiarity is irrelevant because the meat just isn't there. The definition of make-short would help. There's a legit WTF as Merus explained, but it's easily dwarfed by a more forceful WTF from reading this so-called article.

    And I did check the page for hidden elements of randomClass and make-short. It's no surprise that the gaps are born of ineptitude rather than sophistication.

  • James (unregistered)

    I too am confused by this "article".

  • (nodebb)

    I think what's odd about this code is that (visually styled) classes are being added to elements, based either on classes they already have or on the fact that they're images from a particular URL. This means that if you add a class (e.g. "randomClass") to an element then it will have styling that isn't obvious from the CSS. Worse, if you add an image with a particular URL, then that element will have unexpected styling. And if you add a new image expecting it to have that styling then you'll be unpleasantly surprised.

    It's spooky action at a distance is what it is.

  • markm (unregistered)

    First, does "randomClass" have some special meaning in JS, or is it just a WTF-y way of naming a class?

    Second, why would the programmer have found this by searching for "randomClass", but not by searching for "col-sm-6"? Is there some omitted step in the article where he noticed that the images affected belonged to "randomClass"? But even so, wouldn't a search for the actual offending text have been more effective?

  • (nodebb)

    TRWTF is as follows:

    • Rather than going through the whole site and including 'col-sm-6' with all instances of 'randomClass', they used jQuery to add the class.
    • Rather than going through the whole site and including 'col-sm-12' with all instances of 'otherRandomClass', they used jQuery to add the class.
    • Rather than going through the whole site and including 'make-short' with img tags, they used jQuery to add the class to (some) img tags.

    jQuery is (still) a core frontend technology and the basis of many DOM-fuckery frameworks (e.g. React and the now-dying AngularJS). It's good for runtime DOM manipulation. It is not good for development time DOM manipulation.

    IM(not-so)HO this is representative of the other bad decisions in the code.

Leave a comment on “Randomly Functional”

Log In or post as a guest

Replying to comment #494575:

« Return to Article