From 853f9c36df3beeb88dfe6eb77a12249cd944974d Mon Sep 17 00:00:00 2001 From: Mike Sherov Date: Wed, 22 Jul 2015 08:32:49 -0400 Subject: [PATCH] Update UMD Shim to be resilient to HTMLElement global pollution Please see https://github.com/umdjs/umd/pull/63 and https://github.com/umdjs/umd/issues/35 for more information, but this change prevents an HTML element with an id of `exports` from causing the UMD shim to incorrectly detect the environment as node. --- mustache.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mustache.js b/mustache.js index 245c129..03bdcc9 100644 --- a/mustache.js +++ b/mustache.js @@ -6,7 +6,7 @@ /*global define: false Mustache: true*/ (function defineMustache (global, factory) { - if (typeof exports === 'object' && exports) { + if (typeof exports === 'object' && exports && typeof exports.nodeName !== 'string') { factory(exports); // CommonJS } else if (typeof define === 'function' && define.amd) { define(['exports'], factory); // AMD