Anyway its on HN now. FAFO
$('#Fish & Chips').on('change', function () {
if ($('#Fish & Chips').is(':checked')) {
$('.Fish & Chips').css('background-color', '#3a606e;');
$('.Fish & Chips').css('color', '#fff;');
} else {
$('.Fish & Chips').css('background-color', '#fff');
$('.Fish & Chips').css('color', '#3a606e;');
}
});I have a good feeling this is more of copy-pasta code from either Copilot or ChatGPT or StackOverflow. That also explains why they handled encryption the way described in the article.
Dev: "Hey LLM, how do I pass data around in a secure way ?"
Bot: "You can encrypt the data before you send it, so that only users who have the relevant keys can read them"
Dev: "Hey LLM, it is not possible to access the data I have encrypted on the frontend"
Bot: "Here is the javascript code to decrypt the data you have passed then"
But seriously, those selectors are making me cringe. Does it even work with the spaces?
$('[id="Fish & Chips"]')
$('[class="Fish & Chips"]')So using newer CSS selector features, like attribute value selectors, will work fine in post-Sizzle jQuery versions.
There's all sorts of weird stuff, and it definitely looks like the kind of thing you'd see a beginner copy-pasting code and trying things out would create. The site sets a cookie containing the key-value pair "key":"value", for example.
This reminds me of when I first started programming professionally. I’d write loops in PHP like
foreach($orders_by_id as $key => $value) {
$id = $key;
$order = $value;
# ...
}
This was at a small logistics company you’ve never heard of (read: not the best development practices) so the habit was eventually caught in a code review and corrected. I must have written a dozen or so of those prior to that.No idea what the legal precedent for negligent software engineering would be…
I suppose it depends what you consider agreement to social rules and how you define liability. I can certainly be held liable for damages for my actions to others which do not require me to hold any license - merely break the law.
Did I agree to the “rules of the road” when I was born? Do I consent by not emigrating?
(nits, picked…)