swift-toolkit icon indicating copy to clipboard operation
swift-toolkit copied to clipboard

Implement navigator.epubreadingsystem

Open llemeurfr opened this issue 6 years ago • 4 comments

see https://github.com/readium/readium-desktop/issues/120 and https://github.com/readium/architecture/issues/67

It implies a modification on both the testapp and the navigator.

llemeurfr avatar Apr 24 '19 08:04 llemeurfr

I haven't seen a doc detailing how this should be handled. It might be worth discussing this in a call or on the architecture repo first.

HadrienGardeur avatar Apr 24 '19 20:04 HadrienGardeur

Off the top of my head:

  • should be immutable (at least name + version should be unforgeable, cf. this issue in shared-js);
  • to be useful, name should not be shared across several apps but unique – though that opens the door to Reading System sniffing, sometimes you can’t do without this technique, unfortunately, because apps using the same SDK implement things in very different ways;
  • should be available on DOMContentLoaded if I’m not mistaken – that’s a painful one;
  • hasFeature() is a dumpster fire because, in practice:
    • apps don’t agree what each feature means exactly;
    • apps don’t agree how to handle them;
    • conundrum makes it so unreliable you’re better off ignoring this one entirely if you want your scripts to work.
  • best practice of checking epubReadingSystem if you’re attempting to do JS in EPUB is a huge LOL for anyone ever attempting to do JS in EPUB because half the apps that effectively support JS would be ignored for lack of this object implementation.

Edit: And ideally name should be simple because all examples authors may find are checking for the exact string (i.e. navigator.epubReadingSystem.name === "something") so if it’s too complex, it may create extra support tickets because strict equality is pretty much the default in any doc about it.

JayPanoz avatar Apr 27 '19 16:04 JayPanoz

This duplicates readium/r2-testapp-kotlin#182. Can we move comments and close this issue?

HadrienGardeur avatar Jan 29 '20 10:01 HadrienGardeur

I'm keeping this issue opened as it has more details. Here's the original issue from @rkwright:

The EPUB Reading System object does not appear to have been implemented.

Steps to reproduce:

  1. Download EPUBTEST 0102 - Scripting Tests
  2. Open in the app
  3. Navigate to the "Reading System Object" section.
  4. Run the tests

They all fail.

Tested with build 1.0.3

And the twin issue on Kotlin, containing additional details: https://github.com/readium/kotlin-toolkit/issues/222

mickael-menu avatar Feb 08 '21 14:02 mickael-menu