- From: Anne van Kesteren <notifications@github.com>
- Date: Wed, 06 Jan 2016 09:11:05 -0800
- To: whatwg/dom <dom@noreply.github.com>
Received on Wednesday, 6 January 2016 17:11:33 UTC
> @@ -8705,6 +8705,28 @@ associated <a for="/">element</a>'s > <p>Throws a <code>TypeError</code> exception if the associated attribute has no supported tokens defined. > </dl> > > +<p>The <a method for=DOMTokenList lt="supports()">supports()</a> method can be used to detect support for {{DOMTokenList}} tokens: > +<pre class=lang-javascript> > +var DOMTokenListSupports = function(tokenList, token) { > + if (!tokenList || !tokenList.supports) { > + return false; > + } > + try { > + return tokenList.supports(token); > + } catch (e) { > + if (e instanceof TypeError) { > + console.log("The DOMTokenList doesn't have a supported tokens list"); > + } else { > + console.error("That shouldn't have happened"); > + } Also, `console` is not standardized. I guess that doesn't matter. --- Reply to this email directly or view it on GitHub: https://github.com/whatwg/dom/pull/144/files#r48981949
Received on Wednesday, 6 January 2016 17:11:33 UTC