- Feature Articles
- CodeSOD
- Error'd
-
Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Admin
Seems a bit like the average Wordpress plugin. And I can't even say that I've done much better myself, just seems to be the standard, terrible, WP way.
Admin
This type of approach is par for the course in any environment where you've got server-side and client-side script going on (i.e. most web apps). The best (only?) way to avoid it is to use a framework that lets you use the same language on both client and server e.g. nextjs or blazor
Admin
No it doesn't. It adds a CSS class to some HTML elements.
Admin
Bravo.
Admin
You do realise that there's absolutely no need to have Javascript for this at all? It's just statically adding an HTML class at load time, based on some state on the server - that both can and should be handled entirely on the server side to build the appropriate HTML either with or without the class.
Admin
No, do not do this, even if you're using the same language on both sides. The HTTP request is a natural module boundary, do not cross that boundary except through a well defined interface, for example, an XMLHttpRequest. If you really need to pass parameters from the server side to the client side in the document, serialize the parameters to JSON and embed it as a variable, e.g.
let _serverSideParams = <% toJson(myDictionary) %>;
.Admin
"I mean, if you're working in LISP, 90% of your program is going to be macros"
Even in lisp the rule is to only use a macro when you really need to. At least in scheme, common lisp and clojure writing a macro when a function would suffice is a big no-no
Admin
a HTML tag
Admin
Someone flunked Pedantic Grammar 101 . Yes, 'an' before 'h' is gramatically correct usage. Most of the time nobody cares.
Admin
And to be even more pedantic the reason for this is because 'h' makes an 'a' sound when pronounced and since you use 'an' before vowel sounds this is why it's "an HTML tag".
Admin
An aitch tee emm ell tag. So yes, "an HTML tag" is correct. Sheesh.
Admin
No. "An hotel", "an herb", "an hero", etc. are not correct usage.
Admin
"An hotel" is a correct usage in the UK. It is rather old fashioned, but it is correct.
Admin
The French are famous for not pronouncing a 'starting h'. In English/American the 'h' is also sometimes supressed/silenced. Case in point "herbs" can be pronounces as 'erbs. (uurbs) I have never heard anybody pronounce "HTML" as 'MTL (um tee el)
Language is messy.