Quantcast
Channel: Updates
Viewing all articles
Browse latest Browse all 599

DOMTokenList Validation Added in Chrome 50

$
0
0

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.


Viewing all articles
Browse latest Browse all 599

Trending Articles