this site has two programmers

 

dorky femme droid

eggbug enthusiast

important eggbug lore

 


 

if you use the phrase "be normal" as if it's something to aspire to, kindly take a long walk off a short plank. or block me. whichever is easier for you.

 


 

child of the 80s

 


 

i escaped a cult.
all of the content warnings.
all of them.
tag: exerian's tragic backstory

 


 

                                 
eggbug bounce 88x31An 88x31 button advertising Cohost: "no ads. no tracking. yes eggbug."get firefox
   
                                                       
  

wavebeem
@wavebeem

i really like the approach of ONE class + a bunch of data-attributes. not only is it easier to code this way, but it's a lot easier to read the resulting code!

<div
  class="Card"
  data-size="big"
  data-align="center"
></div>

<style>
.Card { /* ... */ }
.Card[data-size=big] { width: 100%; }
.Card[data-size=medium] { width: 50%; }
.Card[data-size=small] { width: 25%; }

.Card[data-align=left] { text-align: left; }
.Card[data-align=right] { text-align: right; }
.Card[data-align=center] { text-align: center; }
</style>
syntax highlighting by codehost

data attributes are woefully underused!


linicks
@linicks

And you can easily access them in JavaScript with the HTMLElement.dataset property. You can just manipulate one of these things instead of toggling a random-ass classname or whatever!


aloe
@aloe
This page's posts are visible only to users who are logged in.

exerian
@exerian

all of this is correct and i'll never forgive them for making me add "data-" to the front of every thing but i guess progress comes at a cost.


You must log in to comment.

in reply to @linicks's post:

in reply to @exerian's post:

i'm fully aware it's a necessary evil but the finger that hits the "-" key literally can't reach it due to injuries. i have to unseat my index finger to reach the stupid key. everything that make me push that key feels personal. lol

ah yeah, i totally get that. i often forget because i do a lot of coding on my custom keyboard where - and _ are on j+MODIFIER.

typing on a laptop right now and reminded how awkward that is ugh

i suffer brutal pain unless i use an ergonomic keyboard but even that will only do so much for me. i've thought about doing custom boards or whatever but i've never had the time, energy and money all at the same time. lol

ironically, that would be more painful for me. which is stupid because i answered phones for a living when i transitioned and the only time i was misgendered it was done in a gender confirming way so, like, i know my voice falls well within the expected range for a woman. the data proves it. still more painful to hear my own voice than to extend a finger. i wish i could just push a button in my brain but so far i haven't been able to find the button.

i'm fully aware it's a necessary evil

to be clear i wasn't trying to say you didn't realize this, i've just also talked with a lot of people who disagree that it's a potential problem and would rather we just break stuff via willy-nilly namespacing :eggbug-nervous:

honestly the biggest "yuck" factor of Custom Elements for me is that there's no namespacing for JS props, so i feel like they could suffer the exact same problem as HTML attributes that don't use the data- namespace, but idk what the official stance is on that...