18

Cleaning up code...

var screenshotPanel = $(this).parent().parent().parent().parent().next().next();

Kill me now.

Comments
  • 0
    ........ What does this return?!?!
  • 0
    @rainmitchell It goes 4 levels up and two forward on the DOM. Returns whatever element it hits.

    Bear in mind if the structure of the page changes or if anything is dynamically injected, that hierarchy is lost and may return a different element than intended.

    The definition of flimsy.
  • 1
    @VinnyFonseca why doesn't he just name and search for the object? Mind I'm not a web developer...
  • 3
    @rainmitchell This is a question that will be left unanswered until the end of times.
  • 0
    I did that several times.

    There is a time in a dev life where you read this:"the api returns something, its there get it"... But what is it? Dynamic.

    So i did something similar since no ids no class and they could have been divs or span....

    Life isn't pretty and documented everywhere :(.
Add Comment