Just happened to find this video and followed most of it since I program in jQuery. Not sure how this compares to that. Is this something new that will be in future browsers' javascript interpreters?
@labobo matchesSelector is ideal for event delegation. Also has some unit test uses. matchMedia you can have an event listener bound to when orientation or screensize changes, and you know that event matches when your CSS mq's are switching over. If your styles are using MQs (media queries) then the JS api lets you write behavior that will match.
@labobo matchesSelector is ideal for event delegation. Also has some unit test uses. matchMedia you can have an event listener bound to when orientation or screensize changes, and you know that event matches when your CSS mq's are switching over. If your styles are using MQs (media queries) then the JS api lets you write behavior that will match.
@STHayden classList, dataset and matchesSelector can be found on caniuse.com. For textContent and matchMedia there are browser compatibility tables on MDN.
very awesome. would love to see more of these. Also would love if you said where current browser support for these stand and if there is any known timeline for future browser improvements. very cool though!
Does the dataset API have a way to delete the attribute, meaning actually remove it like $0.removeAttribute('data-event') would?
RyanVanEtten 3 weeks ago
@RyanVanEtten `delete $0.dataset.event` works for removing.
RyanVanEtten 2 weeks ago in playlist Liked videos
lapel mic please...thank you
RustyRazor2010 5 months ago
Just happened to find this video and followed most of it since I program in jQuery. Not sure how this compares to that. Is this something new that will be in future browsers' javascript interpreters?
KennyWrites 5 months ago
both matchesSelector and matchMedia i see no usage scenarios for really.
can you provide some, the one you specified didn't really make good sense.
classList i'm already using and i love it
dataset useful maybe but why was it really added for ?
textContent is just confusing when you read about innetText, etc that all nearlt do the same thing :S
labobo 5 months ago
@labobo matchesSelector is ideal for event delegation. Also has some unit test uses. matchMedia you can have an event listener bound to when orientation or screensize changes, and you know that event matches when your CSS mq's are switching over. If your styles are using MQs (media queries) then the JS api lets you write behavior that will match.
paulirish 5 months ago
This has been flagged as spam show
@labobo matchesSelector is ideal for event delegation. Also has some unit test uses. matchMedia you can have an event listener bound to when orientation or screensize changes, and you know that event matches when your CSS mq's are switching over. If your styles are using MQs (media queries) then the JS api lets you write behavior that will match.
paulirish 5 months ago
I see you started to type jQuery there ;)
Really cool stuff seeing this implemented into standard JS, thanks for the video.
warlord90210 5 months ago
apple sucks.
JLUFantasy 5 months ago
@STHayden classList, dataset and matchesSelector can be found on caniuse.com. For textContent and matchMedia there are browser compatibility tables on MDN.
ecmazing 5 months ago
Btw for those of you who'd like to know where that stuff is specified:
classList and dataset --> HTMLElement interface --> HTML Living Standard chapter 3.2.2
textContent --> Node interface --> DOM4 chapter 5.2
matchesSelector --> Element interface (extension) --> Selectors API 2 chapter 6.2
window.matchMedia --> Window interface (extension) --> CSSOM View chapter 4
ecmazing 5 months ago 7
very awesome. would love to see more of these. Also would love if you said where current browser support for these stand and if there is any known timeline for future browser improvements. very cool though!
STHayden 5 months ago
You didn't mention you can also add data attributes using the tiny data api:
element.dataset.foo = 'bar'
rudiedirkx 5 months ago
first
chups23 5 months ago