BigBlueHat commented on issue #21: Ability to use multiple layers of annotation.
URL: 
https://github.com/apache/incubator-annotator/issues/21#issuecomment-348224795
 
 
   The way this has been done in the past (afaik) is to keep references to the 
groups of DOM nodes that represent a single annotation--and juggle all the 
interleaved DOM nodes if/when anything changes. It's beyond inefficient, but 
it's what happens when you cram to trees together...
   
   So, from your example, you'd end up with something like this (pseudo code 
here also):
   ```html
   <p><mark data-anno-id="3">Something </mark><mark data-anno-id="1"><mark 
data-anno-id="3"><mark data-anno-id="2">is</mark></mark><mark data-anno-id="3"> 
here</mark></mark></p>
   
   <p><mark data-anno-id="345">And there's more text</mark> down here</p>
   ```
   
   Lovely, right? ? The text in each selection would be:
   1. "is"
   2. "is here"
   3. "Something is here And there's more text"
   
   Presented as a tree this looks like:
   ```html
   <p>
     <mark data-anno-id="3">Something </mark>
     <mark data-anno-id="1">
       <mark data-anno-id="3">
         <mark data-anno-id="2">is</mark>
       </mark>
       <mark data-anno-id="3"> here</mark>
     </mark>
   </p>
   
   <p>
     <mark data-anno-id="345">And there's more text</mark>
     down here
   </p>
   ```
   
   The DOM will think of (and treat) several of these `<mark>` tags as parents 
or children of other `<mark>` tags. The annotation software, however, would 
treat them as unrelated and remove/add/change their occurrences wherever 
they're found. Finding them is one thing 
(`document.querySelectorAll('[data-anno-id=3]`) creating them interleaved 
inside other stuff is entirely another...

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to