Home Forums General XMetaL Discussion Help with .IsAdjacent Reply To: Help with .IsAdjacent

Derek Read

Reply to: Help with .IsAdjacent

.IsAdjacent returns true when the selection (or insertion point, aka: cursor) is immediately adjacent to the Range you are testing (either immediately to the left or right). If the selection includes or is inside another element node then that will also return false.

So, in your example, for a test using .IsAdjacent on the second to return true the selection needs to be between the closing tag of the first emph and the opening tag of the second one (where I have marked ***here***):

40(6) ***here***[Nov.–Dec. 2014].

Given what you are doing, I'm not sure how useful .IsAdjacent is going to be. Perhaps using DOM nextSibling and previousSibling would be better?