When writing about HTML/CSS/JS, how would you embed interactive demos into articles?
I consider to do something like using figure and figcaption elements, use an iframe inside the figure with the demo, add description and also provide the link to the code inside figcaption.
With #js enabled, it could maybe progressively enhance to a widget with html/css/js/result panels.
I often put the code directly into the #HTML of the article. In most CMS (if you use one?) there are plugins to add individual #CSS and #JS to each article.
In #WordPress I use the "scripts and styles" plugin. If I want to display the code as well, I use additional <pre> elements.
The amount of trouble I have with JS's dataset because in my mind it reads more as "data set" as in "set the data value" than "a set of data values".
I always try element.data.whatever when I need element.dataset.whatever because I'm trying to READ a data attribute on an element but dataset cognitively doesn't seem like a read operation, but a write one.
This is the trouble with language design. "set" the math term is not as common as "set" the english action term.
This is hilarious. A #Google engineer invented #zx to make command line scripting easier with #NodeJS, because at a certain point #shell scripts get too complicated and you need a Real #Programming Language.
This is exactly #Perl’s use case from thirty-six years ago. But the kids want #JavaScript everywhere and would rather it take more work to convert their ascended #Bash scripts to a vastly different syntax.
https://fuckgov.org/@h Oh, I don’t deny it’s useful. And you’ll never catch me saying it’s bad to stick with what you know if it gets the job done—that’s one reason I continue to use #Perl.
My main point was that it’s less work converting #Bash to Perl than to #JavaScript.
The “kids want JavaScript everywhere” was admittedly a little snark directed at the “continuous amnesia” of prior art (not unique to #JS developers but their sheer number means it’s really prevalent) as described here: https://www.ufried.com/blog/continuous_amnesia_issue/
I continue to feel that this feature cluster is worse than being tracked by cookies from tracking pixels. Tracking pixels I at least have a reasonable understanding of when and why I get tracked: A website I visit can track me, and I can control this by what I do and don't block. If this is "topics" the browser seems to be gathering information independently and just volunteering it. That's creepier than creepy https://mastodon.social/@rmondello@hachyderm.io/110379170600324295
@mcc If your site has any 3rd party #JS on it, then a 3rd party script can insert a Topics API iframe and JS in the iframe can call Topics API to track your users. In order to prevent this you can set a Permissions-Policy header:
So in case anyone was following this: it appears that built-in objects like Date in JavaScript have some internal magic (read: inconsistencies)* that means you can’t proxy them as you would normally.
Not sure if this is fixable in #JSDB. The “solution” might be to discourage use of Date objects and instead persist timestamps. Which is, quite frankly, a pain in the ass.
If you’re using HTML Validate (you should; it’s ace), update to 7.15.2. It no longer flags multiple buttons with the same name used in forms as a validation error (this is a valid pattern that lets you interpret a form differently on the server based on which button it was submitted with).
I'm trying out https://runjs.app for prototyping js/node.js snippets locally.
Creating a new node project every time I just want to run a quick node.js snippet is just too time consuming.
Interested in any suggestions of similar tools js devs recommend. I know repl.it is another option, but running locally is a requirement for me. #js#webdev#node#tools
@alcinnz
I'm constantly raising an eyebrow at websites that don't even display basic text and images with JS turned off, or whose layout code is so JS-dependent the page turns into a hot mess without JS running. It's like a road you can't cycle or take public transport on, because the people who designed and built it expect you to be in a private motor vehicle. In both cases, it's hell for accessibility.