How do I find the string index of a tag (an element) without counting expanded entities?
问题 I've got a large piece of text which I want to be able to select, storing the selected part by its startindex and endindex . (For example, selecting or in word would give me startindex 1 and endindex 2 .) This all works properly, but I've got a problem with HTML entities such as & (the ampersand). I've created a little case in which the issue consists. You can see in the fiddle below that the startIndex inflates if you select anything beyond the & , because it doesn't count the & as a single