Can’t make the #ChromeDevSummit this year? Catch all the content (and more!) on the livestream, or join your peers for a CDS Extended event at a hosted location nearby. To learn more, check out the Chrome Dev Summit 2019 website.

DOMTokenList Validation Added in Chrome 50

In Chrome 50, you'll be able to check the support of options for some HTML attributes that are backed by DOMTokenList instances in JavaScript. Right now, these places are:

  • iframe sandbox options
  • link relations (the rel attribute, or relLink in JavaScript)

Let's show a quick example:

  var iframe = document.getElementById(...);
  if (iframe.sandbox.supports('an-upcoming-feature')) {
    // support code for mystery future feature
  } else {
    // fallback code
  if (iframe.sandbox.supports('allow-scripts')) {
    // instruct frame to run JavaScript
    // NOTE: this is well-supported, and just an example!

As the list of supported options grows and changes, you can use feature detection to perform the correct actions for your web applications.