I also tried your test case and I am seeing the exact same things as DNSB. If I click on the first "always" in Preview I get the start that paragraph in CodeView. In Preview if I click on the second "always" I get that line highlighted in CodeView.
Going the reverse direction, In CodeView if I click on the first "always": Preview moves to show it. If I click on the second "always", I do see Preview flick to the top. But I can still see that final line. Is that what you are referring to?
If additional tags with text exist after the xhtml-comment then Preview will properly reposition itself if you click on that text.
Again, the issue is that the xhtml comment does not have a node or position in the parsed DOM tree. So anything appended to the end of that missing node simply does not have a valid position to make Preview scroll to. It is effectivly attached to the end of the previous node's contents. A new tag pair after that will allow Preview to find things again as it has a node in the parsed DOM tree.
You just can not scroll Preview to something that does not exist. This is how all web browsers work. I can not change that.
To make Preview scroll you have to tell it which "node" in its internal DOM tree to scroll to. A node is a valid tag not an inline xhtml comment that gets stripped out.
As I explained before, If you want something unseen to mark places in your text instead of using xhtml comments use an empty span with a page number as the id, or an empty "a" tag with an id for the page number, or wrap the first word on the new page with a span tag and id based on page number instead of using xhtml comments. This has the added advantage of actually allowing you to jump directly to specific pages in final PageLists in the ncx and nav.
It is easy with TagMechanic or even Sigil using find and replace to find empty span tags with specific id formats and remove them if you no longer want them after editing.
Hope this explains things more clearly.
Last edited by KevinH; 08-09-2023 at 10:31 AM.
|