瀏覽代碼

Handle non-existence of HTMLElement type when creating shaders

Scott Ramsby 7 年之前
父節點
當前提交
d12c808cd5
共有 1 個文件被更改,包括 2 次插入2 次删除
  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);