• (nodebb)

    Maybe some frist-class idiot manager decided that using CSS was a strict requirement, and then didn't bother (or was incapable of) checking that it was used in a sane way.

  • Sauron (unregistered)

    Get rid of it little by little.

    Page after page, remove the class that is detected by jQuery, and hard-code the asterisk in the HTML. When there is no use of jQuery anymore, remove jQuery.

    And during code reviews, roast whoever adds more uses of that bad code.

  • Argle (unregistered)

    "Sean" is probably a pseudonym, but in the event it's not, it sounds like a former co-worker. If it is, good luck with this one, old friend! But then, wait a month and you'll have another client with another mess just like this one.

    The struggle continues.

  • dusoft (unregistered) in reply to Sauron

    Or just use CSS content ::after...

  • löchlein deluxe (unregistered) in reply to dusoft

    Inputs don't have ::before and ::after, IIRC. (At least not all of them.) They do have a required attribute since HTML 5, though.

  • (nodebb)

    You'll need to update every field label (...)

    The change from an mandatory input to an optional and the other way around results often in a major business logic change. Even if you have a very dumb terminal client there might be logic that actually changes on the client-side beyond a simple representation change, so in practice you have to check the usage of the input everywhere because it is basically a type change - turning an non-nullable type into a nullable type. And we all know that in proper null handling is still one of the biggest sins bad developers do. Oh and before anyone response with "Javascript is typeless" - yes, that means the responsibility of ensure the correct business case is on the developer without the safety net for the language preventing you from invalid usage, so it is even more work on the developer side. I guess a lot of inexperience developers are not aware of this, resulting in the big pile of bad Javascript code we have these days.

  • NoLand (unregistered) in reply to löchlein deluxe

    Inputs don't have ::before and ::after, IIRC. (At least not all of them.) They do have a required attribute since HTML 5, though.

    I guess, this may be well how this started. They intended to use a ::before or ::after pseudo-element on the input element and found that they couldn't do it. So probably in some existential despair, they decided to fix this up in JS. (Well, they didn't really do so, rather using JQuery for no reason.) For this, they moved the class name to a newly introduced span to provide an anchor for the JQuery call. Busily fixing the fix, they totally missed that at this point they could have had inserted a plain asterisk as well…

    (Also, as indicated, this is allegedly old code, so this may have been before the required attribute was reliably a thing.)

  • NoLand (unregistered) in reply to NoLand

    PS:

    they totally missed that at this point they could have had inserted a plain asterisk as well…

    Or it may have been still close to the requirements. At least, they were doing as intended, just by "a little help" by JQuery. Still, the result (and even the flow) is somewhat close to what would have been achieved using pure CSS.

Leave a comment on “Required Requirements”

Log In or post as a guest

Replying to comment #:

« Return to Article