What is anchorNode , baseNode , extentNode and focusNode in the object returned by document.getSelection?

后端 未结 3 763
南方客
南方客 2021-01-31 08:41

If I make a selection in a html page and I do :

var a = document.getSelection()

I get an object with four properties :

  1. anchorNod
3条回答
  •  执念已碎
    2021-01-31 09:20

    I have been building out a feature that requires nested contenteditable elements. When debugging I noticed that baseNode and extentNode are NOT just aliases. I am trying to find documentation on them since they are not in MDN. But based on this screenshot I wouldn't assume they are just aliases (in Chrome):

提交回复
热议问题