* Polyfill for `document.contains()` method. Notice that according to spec * `document.contains` is inclusionary. * See https://developer.mozilla.org/en-US/docs/Web/API/Node/contains * @param {?Node} node * @return {boolean} * @this {Document}
(node)
| 7 | * @this {Document} |
| 8 | */ |
| 9 | function documentContainsPolyfill(node) { |
| 10 | // Per spec, "contains" method is inclusionary |
| 11 | // i.e. `node.contains(node) == true`. However, we still need to test |
| 12 | // equality to the document itself. |
| 13 | // eslint-disable-next-line local/no-invalid-this |
| 14 | return node == this || this.documentElement.contains(node); |
| 15 | } |
| 16 | |
| 17 | /** |
| 18 | * Polyfills `HTMLDocument.contains` API. |