CreateTextRange is not working in Chrome

后端 未结 4 1873
南方客
南方客 2020-12-03 11:17

In this code, createRange is not working in Chrome. In IE it is working. Please help how to rectify in this. Is there any other property to work like create ran

4条回答
  •  隐瞒了意图╮
    2020-12-03 11:33

    As of March 31, 2020. This works for mocking JSDOM for jest unit tests

    (window as any).global.document.createRange = () => {
        return {
            setEnd: () => {},
            setStart: () => {},
            getBoundingClientRect: () => {},
            getClientRects: () => []
        };
    };
    

提交回复
热议问题