all files / dom/shim/ fixContains.js

100% Statements 6/6
100% Branches 2/2
100% Functions 1/1
100% Lines 6/6
1 2 3 4 5 6 7 8 9 10 11  20× 20× 35× 15×        
 /* istanbul ignore next */
export function fixContains(root, el) {
    try { //IE6-8,游离于DOM树外的文本节点,访问parentNode有时会抛错
        while ((el = el.parentNode)){
            if (el === root)
                return true
        }
    } catch (e) {
    }
    return false
}