fizzstudio / nanotation

Prototype Chrome extension to enable "deep link" sharing of a selection, with anyone else who has this extension. Now being developed by Fizz Studio.
MIT License
9 stars 1 forks source link

break when no previousSibling #7

Closed pkra closed 6 years ago

pkra commented 6 years ago

https://github.com/shepazu/nanotation/blob/master/content_script.js#L177-L180 should break when there's no id_el, e.g.,

  // first check previous siblings for an id
  while ( !id) {
    id_el = id_el.previousElementSibling;
    if (!id_el) break;
    id = id_el.id;
  }

Otherwise, there'll be an error when trying to look up id of null.

shepazu commented 6 years ago

Thanks so much, Peter! Fixed, per your suggestion.

I need a better testing and PR regime for this little side-project.