Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When selection start with <br/> element, the getRangeCfiFromDomRange() return wrong range cfi #345

Open
JackieFei opened this issue Nov 18, 2016 · 1 comment

Comments

@JackieFei
Copy link

This issue is a Bug

Expected Behaviour

get correct range cfi

Observed behaviour

Readium return the contentCFI:"/4[x9-8000]/6/4,,/7:13” which start cfi is empty

Steps to reproduce

  1. open https://readium.firebaseapp.com/?epub=epub_content%2Flinear-algebra&
  2. jump to Chapter 1. Theorems
  3. make a selection as below: ( Note: must start selection at blank area !! )
    ezgif com-4b12bb4aa9
  4. open developer tool console, enter 5 commands:
    var sel = document.getElementsByTagName('iframe')[0].contentDocument.getSelection()
    var range = document.getElementsByTagName('iframe')[0].contentDocument.createRange()
    range.setStart(sel.anchorNode,sel.anchorOffset)
    range.setEnd(sel.focusNode,sel.focusOffset)
    ReadiumSDK.reader.getRangeCfiFromDomRange(range)
  5. the returned range cfi is "/4[x9-8000]/6/4,,/7:13" (start cfi is empty)
    2016-11-18 11 17 35

Product

Readium cloud reader app

Additional information

Maybe caused by self-closing tags
2016-11-18 11 19 04

@JackieFei JackieFei changed the title When selection include <br/> element, the getRangeCfiFromDomRange() return wrong range cfi When selection start with <br/> element, the getRangeCfiFromDomRange() return wrong range cfi Nov 18, 2016
@danielweck
Copy link
Member

I assigned @jccr just as a heads-up, just in case there is already a fix via another issue or pull request.
Related: #353 and #353

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants