documentcloud / documentcloud-notes

Responsively embed DocumentCloud notes.

Home Page:https://documentcloud.github.io/documentcloud-notes/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

note images get clobbered when max-width is set to anything other than 'none'

knowtheory opened this issue · comments

One of the consequences of writing things into someone else's DOM is sharing their CSS rules.

We need our note images to have a max-width and max-height set to none or else our width and positioning calculations end up coming out wrong.

Due to selector specificity (a page may use an ID on an element, and note embeds can't use IDs to override their specificity), i suspect we don't have any choice except to inline those directives.

I've built a test for this into the horribly janky test page in this commit: 06640d6

And implemented the fix by just inlining the styles in this commit: b61c4e3

Also credit where credit is due:

Thanks to @JoeGermuska for reporting the issue after seeing it on http://www.propublica.org/article/nsa-documents-suggest-close-relationship-between-nsa-us-companies

Thanks dude!