]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Enable the script to load in DoneJS SSR 8903/head 8904/head
authorMarshall Thompson <marshall@creativeideal.net>
Mon, 6 Jun 2016 15:53:48 +0000 (09:53 -0600)
committerMarshall Thompson <marshall@creativeideal.net>
Mon, 6 Jun 2016 15:53:48 +0000 (09:53 -0600)
Adding this check for `script && script.parentNode` allows foundation-sites to work with DoneJS's Server Side Rendering.

js/foundation.util.mediaQuery.js

index e98555dc2a53aaf43df0a6a14a7c9d81ac1b7cae..d9ddce544f75f86f1bc45e2e622599b261e1ff9e 100644 (file)
@@ -142,7 +142,7 @@ window.matchMedia || (window.matchMedia = function() {
     style.type  = 'text/css';
     style.id    = 'matchmediajs-test';
 
-    script.parentNode.insertBefore(style, script);
+    script && script.parentNode && script.parentNode.insertBefore(style, script);
 
     // 'style.currentStyle' is used by IE <= 8 and 'window.getComputedStyle' for all other browsers
     info = ('getComputedStyle' in window) && window.getComputedStyle(style, null) || style.currentStyle;