• Robert Knight's avatar
    Fix the implementation of `isNodeInRange()` (#3522) · 8cbdc1e2
    Robert Knight authored
    This function failed to account for the case where the node was
    contained by, but not equal to, the range's startContainer.
    
    In new browsers we could just use `Range.isPointInRange()`. Since that
    is not available in IE 10/11, add an implementation adapted from
    Blink's `Range::isPointInRange()` C++ impl, minus support for the
    `offset` parameter.
    
    This fixes an issue where the adder could fail to show up when making
    certain selections because `getTextBoundingBoxes()` could incorrectly
    fail to find the text nodes within certan ranges.
    
    Fixes #3521
    8cbdc1e2
range-util.js 4.11 KB