setStart and setEnd throwing error when trying to programmatically select text in UIWebView

后端 未结 1 1723
悲&欢浪女
悲&欢浪女 2021-01-25 11:38

Here is some HTML that I am working with in my UIWebView:


                      
相关标签:
1条回答
  • 2021-01-25 12:13

    The problem is that you're trying to set the range's boundaries in the first child node of the <div> element, which is either a white space-only text node if your HTML really does look like it does in the question, or the <span> element if there is no white space in your actual HTML. In the latter case, i.e. setting a range boundary in an element, the offset represents the number of child nodes of the element preceding the boundary.

    0 讨论(0)
提交回复
热议问题