소스 검색

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,6 +149,38 @@ function _visitNode(node, callback) {
149 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 184
         // Element.querySelector
153 185
         //
154 186
         // Required by:

Loading…
취소
저장