瀏覽代碼

fix(polyfills): implement createHTMLDocument for jquery

master
Leonard Kim 7 年之前
父節點
當前提交
466561f99f
共有 1 個檔案被更改,包括 32 行新增0 行删除
  1. 32
    0
      react/features/base/lib-jitsi-meet/native/polyfills-browser.js

+ 32
- 0
react/features/base/lib-jitsi-meet/native/polyfills-browser.js 查看文件

149
             document.cookie = '';
149
             document.cookie = '';
150
         }
150
         }
151
 
151
 
152
+        // document.implementation
153
+        //
154
+        // Required by:
155
+        // - jQuery
156
+        if (typeof document.implementation === 'undefined') {
157
+            document.implementation = {};
158
+        }
159
+
160
+        // document.implementation.createHTMLDocument
161
+        //
162
+        // Required by:
163
+        // - jQuery
164
+        if (typeof document.implementation.createHTMLDocument === 'undefined') {
165
+            document.implementation.createHTMLDocument = function(title = '') {
166
+                const htmlDocument
167
+                    = new DOMParser().parseFromString(
168
+                        `<html>
169
+                            <head><title>${title}</title></head>
170
+                            <body></body>
171
+                        </html>`,
172
+                        'text/xml');
173
+
174
+                Object.defineProperty(htmlDocument, 'body', {
175
+                    get() {
176
+                        return htmlDocument.getElementsByTagName('body')[0];
177
+                    }
178
+                });
179
+
180
+                return htmlDocument;
181
+            };
182
+        }
183
+
152
         // Element.querySelector
184
         // Element.querySelector
153
         //
185
         //
154
         // Required by:
186
         // Required by:

Loading…
取消
儲存