7 minutes on recent DOM APIs

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
11,061
Loading...
Alert icon
Sign in or sign up now!
Alert icon
There is no Interactive Transcript.

Uploaded by on Sep 28, 2011

Paul Irish gives you a heads up on recent DOM APIs with good browser support that were designed to make things easier for you. HTML5 classList, dataset, matchMedia(), textContent, and matchesSelector() are explained and demonstrated.

Category:

Science & Technology

Tags:

License:

Standard YouTube License

Link to this comment:

Share to:

Top Comments

  • 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

  • @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.

see all

All Comments (14)

Sign In or Sign Up now to post a comment!
  • @RyanVanEtten `delete $0.dataset.event` works for removing.

  • Does the dataset API have a way to delete the attribute, meaning actually remove it like $0.removeAttribute('data-event­') would?

  • lapel mic please...thank you

  • 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?

  • 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

  • I see you started to type jQuery there ;)

    Really cool stuff seeing this implemented into standard JS, thanks for the video.

  • apple sucks.

  • @STHayden classList, dataset and matchesSelector can be found on caniuse.com. For textContent and matchMedia there are browser compatibility tables on MDN.

Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more