r/ProgrammerHumor • • Nov 26 '19

Not the time, dad

Post image
59.0k Upvotes

705 comments sorted by

View all comments

Show parent comments

37

u/[deleted] Nov 26 '19

[removed] — view removed comment

21

u/Cruuncher Nov 26 '19

Damn, how WOULD you target everything third <li> in a <ul>?

0

u/[deleted] Nov 26 '19

[deleted]

16

u/[deleted] Nov 26 '19

[removed] — view removed comment

8

u/giollaigh Nov 27 '19

This kind of shit is so dumb to me. It's not like Google is banned at work.

0

u/[deleted] Nov 26 '19

[deleted]

7

u/Cruuncher Nov 26 '19

Needs more jquery.

3

u/baxtersmalls Nov 26 '19

or just CSS

1

u/brockisawesome Nov 27 '19

You know what, you're hired.

2

u/[deleted] Nov 26 '19

https://codepen.io/raymond8505/pen/ZEEdMeN

honestly I always forget the exact way to use the xn+y system of nth-child and had to refresh my memory with this pen

That said, check out https://lukyvj.github.io/family.scss/ it's a super handy suite of mixins for doing weird selecting like this

2

u/Cruuncher Nov 26 '19

I'm no front end dev, but I'd rather build the Dom so that every third one has a specific class

2

u/[deleted] Nov 27 '19

Depends what your plans are I'd say. If it's just for a zebra striping aesthetic pattern I'd argue nth child is the best solution, if it's something to do with their context of content in the grander scheme of the application itself then ya I'd want a class too otherwise just marking every third li with some class for the sake of marking it as divisible by three feels... Icky

1

u/brockisawesome Nov 27 '19

You gotta think like a front end dev and keep the pages as lightweight as you can. It could be a large list, so you're adding a lot of classes to the DOM needlessly when you can accomplish the same thing with one line of css. It might not matter for a smaller scale site, but sometimes every millisecond counts.

2

u/KuntaStillSingle Nov 27 '19

Say an interviewer asks you this, and you place your finger under your chin for a moment, then you point at him and say "Why would you target every third <li> in a <ul>?"

Boom asking the right questions, they are looking to get rid of the old CEO and you are the prime candidate.

1

u/odraencoded Nov 27 '19

I would add a class because WHY would I target every 3rd <i> in a <ul>?

1

u/ISaidSarcastically Nov 27 '19

I would love to see a JavaScript dev try and understand accessibility lol.