Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(chat): polyfills for lib-jitsi-meet ChatRoom#onPresence (#2678)

virtuacoplenny1e0a3ceb7476
diff --git a/react/features/base/lib-jitsi-meet/native/polyfills-browser.js b/react/features/base/lib-jitsi-meet/native/polyfills-browser.js
index 5b435a8c52..86e70ce15a 100644
--- a/react/features/base/lib-jitsi-meet/native/polyfills-browser.js
+++ b/react/features/base/lib-jitsi-meet/native/polyfills-browser.js
@@ -195,6 +195,18 @@ function _visitNode(node, callback) {
};
}
+ // Element.remove
+ //
+ // Required by:
+ // - lib-jitsi-meet ChatRoom#onPresence parsing
+ if (typeof elementPrototype.remove === 'undefined') {
+ elementPrototype.remove = function() {
+ if (this.parentNode !== null) {
+ this.parentNode.removeChild(this);
+ }
+ };
+ }
+
// Element.innerHTML
//
// Required by:
@@ -231,6 +243,31 @@ function _visitNode(node, callback) {
}
});
}
+
+ // Element.children
+ //
+ // Required by:
+ // - lib-jitsi-meet ChatRoom#onPresence parsing
+ if (!elementPrototype.hasOwnProperty('children')) {
+ Object.defineProperty(elementPrototype, 'children', {
+ get() {
+ const nodes = this.childNodes;
+ const children = [];
+ let i = 0;
+ let node = nodes[i];
+
+ while (node) {
+ if (node.nodeType === 1) {
+ children.push(node);
+ }
+ i += 1;
+ node = nodes[i];
+ }
+
+ return children;
+ }
+ });
+ }
}
// FIXME There is a weird infinite loop related to console.log and