- From: Domenic Denicola <notifications@github.com>
- Date: Thu, 07 Jan 2016 08:24:57 -0800
- To: whatwg/dom <dom@noreply.github.com>
Received on Thursday, 7 January 2016 16:25:48 UTC
> + > +<pre class=lang-javascript> > +var DOMTokenListSupports = function(tokenList, token) { > + if (!tokenList || !tokenList.supports) { > + return; > + } > + try { > + return tokenList.supports(token); > + } catch (e) { > + console.log("The DOMTokenList doesn't have a supported tokens list"); > + } > +}; > + > +var linkSupportsToken = DOMTokenListSupports(document.createElement("link").relList, supportedToken); > +var classListSupportsFoo = DOMTokenListSupports(document.createElement("div").classList, "foo"); // undefined + console.log > +var linkSupportsFoo = DOMTokenListSupports(document.createElement("link").relList, "foo"); // false I don't see a need for two examples for link. JavaScript developers know how to use variables. --- Reply to this email directly or view it on GitHub: https://github.com/whatwg/dom/pull/144/files#r49091683
Received on Thursday, 7 January 2016 16:25:48 UTC