readium / readium-js-viewer

👁 ReadiumJS viewer: default web app for Readium.js library
BSD 3-Clause "New" or "Revised" License
550 stars 186 forks source link

Exclude hypothesis highlights from theme styling #664

Closed jccr closed 6 years ago

jccr commented 6 years ago

Highlights created using Hypothes.is don't render properly when using the viewer's content themes.

This change makes it so the theme's styles are still applied to the whole of the document, except it excludes two elements, elements and links.

jccr commented 6 years ago

I noticed that if the style's selector is body from the outside that gets turned into a "global style" internally with a selector of body, body::after, body::before, body *, body *::after, body *::before I think this new selector of :not(a):not(hypothesis-highlight) has a similar effect but I'm not sure. Do you have any thoughts @danielweck ?

danielweck commented 6 years ago

setStyles https://github.com/readium/readium-shared-js/blob/9bb1df070c6b2bca5a4938313653f743ffd37c1a/js/helpers.js#L760