Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
@Sony-wf-1000xm3
Nana.... getElementById does one thing.
querySelector is pretty much everything.
And I like the name. ;)
To the bash part: Yeah.
Want to know why? -
Voxera115854yYou could just assign it to a variable.
var ID = document.getElementById;
Then you can just write
ID(“myid”)
I used to do something similar long before jquery came around, bug I actually used the $ sign just like jquery did, stole that idea from some code example I found. -
@Voxera sometimes that creates errors related to this's context so it's best to use
@highlight
const wrapper = (...args)=>target_function(...args); -
Voxera115854y@melezorus34 that was not something I thought much about 20 years ago ;)
But in this case it should no be a problem since we are calling a dom method and returning an object.
As far as I know document.getElementById does not use this so it should be safe.
If we did this for a method we created this could be a problem yes.
Related Rants
-
justamuslimguy20All the stupid date functions where the days range from 1 to 31 but the months range from 0 to 11
-
sudo-woodo16Whatever the fuck Python's ternary operator syntax is supposed to be.
-
Root18Most hated language features? PL/SQL: • it exists XSLT: • it also exists PHP: • it still exists. VB:...
The document.getElementbyId function . It is so long.
Aldo this probably poes not count but the export function does not accespt whitespace before and after the = sign
So instead of
export PATH = "$PATH:/foo/bar/baz"
You need to write
export PATH="$PATH:/foo/bar/baz"
rant
wk229