Sha256: 6a311c70876aecffa3e15119098823bbd8d237b1da5f5096e6e7fe0730ad607a
Contents?: true
Size: 1.28 KB
Versions: 11
Compression:
Stored size: 1.28 KB
Contents
/** * Wrapper for Node#contains; PhantomJS does not support Node#contains and erroneously reports that it does * @method contains * @memberof axe.utils * @param {VirtualNode} vNode The candidate container VirtualNode * @param {VirtualNode} otherVNode The vNode to test is contained by `vNode` * @return {Boolean} Whether `vNode` contains `otherVNode` */ axe.utils.contains = function(vNode, otherVNode) { /*eslint no-bitwise: 0*/ 'use strict'; function containsShadowChild(vNode, otherVNode) { if (vNode.shadowId === otherVNode.shadowId) { return true; } return !!vNode.children.find(child => { return containsShadowChild(child, otherVNode); }); } if (vNode.shadowId || otherVNode.shadowId) { return containsShadowChild(vNode, otherVNode); } if (vNode.actualNode) { if (typeof vNode.actualNode.contains === 'function') { return vNode.actualNode.contains(otherVNode.actualNode); } return !!( vNode.actualNode.compareDocumentPosition(otherVNode.actualNode) & 16 ); } else { // fallback for virtualNode only contexts (e.g. linting) // @see https://github.com/Financial-Times/polyfill-service/pull/183/files do { if (otherVNode === vNode) { return true; } } while ((otherVNode = otherVNode && otherVNode.parent)); } return false; };
Version data entries
11 entries across 11 versions & 1 rubygems