swift-toolkit
swift-toolkit copied to clipboard
Implement navigator.epubreadingsystem
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.
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.
Off the top of my head:
- should be immutable (at least
name+versionshould be unforgeable, cf. this issue in shared-js); - to be useful,
nameshould 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
DOMContentLoadedif 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
epubReadingSystemif 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.
This duplicates readium/r2-testapp-kotlin#182. Can we move comments and close this issue?
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:
- Download EPUBTEST 0102 - Scripting Tests
- Open in the app
- Navigate to the "Reading System Object" section.
- 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