Browse Source

Handle non-existence of HTMLElement type when creating shaders

Scott Ramsby 7 years ago
parent
commit
d12c808cd5
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/Materials/babylon.effect.ts

+ 2 - 2
src/Materials/babylon.effect.ts

@@ -471,7 +471,7 @@
 
         /** @hidden */
         public _loadVertexShader(vertex: any, callback: (data: any) => void): void {
-            if (Tools.IsWindowObjectExist()) {
+            if (Tools.IsWindowObjectExist() && typeof(HTMLElement) !== "undefined") {
                 // DOM element ?
                 if (vertex instanceof HTMLElement) {
                     var vertexCode = Tools.GetDOMTextContent(vertex);
@@ -507,7 +507,7 @@
 
         /** @hidden */
         public _loadFragmentShader(fragment: any, callback: (data: any) => void): void {
-            if (Tools.IsWindowObjectExist()) {
+            if (Tools.IsWindowObjectExist() && typeof(HTMLElement) !== "undefined") {
                 // DOM element ?
                 if (fragment instanceof HTMLElement) {
                     var fragmentCode = Tools.GetDOMTextContent(fragment);