==== What is the problem?
WWT extension does not necessarily preserve the HTML of the article as it originally was, even after closing.
I think there are two parts to this bug:
1. The HTML returned by WhoColor is not exactly the same as the HTML in the original article.
2. At the point when the WWT extension stores the original HTML of the article, not all the HTML has been loaded. When it attempts to restore the original HTML, some things might be missing.
The first might be tricky, because WhoColor relies on the [[ https://www.mediawiki.org/wiki/API:Parsing_wikitext | MediaWiki wikitext parsing API ]], which presumably ignores any HTML added to the article dynamically (i.e. by JavaScript).
For the second, is it possible to make the WWT extension the very last thing to be loaded, so the article has been fully generated?
==== Example 1
When using the WhoWroteThat tool on an article, any images which linked to Commons have their links changed to the local counterpart.
For example, https://commons.wikimedia.org/wiki/File:Nasa_brazil_fires_20190820.jpg gets changed to https://es.wikipedia.org/wiki/Archivo:Nasa_brazil_fires_20190820.jpg.
From experimenting, the <a> element has its href changed. The <img> element appears untouched.
Therefore, I don't think the images as they appear on the page will be changed. Just where you go when you click on them.
===== Steps to reproduce problem
Install the extension using the [[ https://github.com/wikimedia/WhoWroteThat#testing-the-browser-extension | instructions ]].
1. Go to https://es.wikipedia.org/wiki/Incendios_de_la_selva_amaz%C3%B3nica_de_Brasil_de_2019
2. Click on any image on the page, see it goes to https://commons.wikimedia.org
3. In the left sidebar, click "Who Wrote That?"
4. If WWT reports an error, close the infobar at the top
5. Click on the same image you clicked on in step 2
6. Close WWT
7. Click the same image from step 2
**Expected behavior:** Takes you to https://commons.wikimedia.org
**Observed behavior:** Takes you to https://es.wikipedia.org
===== Background
Some wikis can display images from [[ https://www.mediawiki.org/wiki/Manual:Image_administration#Foreign_Repositories | foreign repositories ]], such as Commons. This appears quite common on https://es.wikipedia.org.
==== Example 2
The [[ https://en.wikipedia.org/wiki/Template:Coord | {{Coord}} ]] template has its [[ https://www.mediawiki.org/wiki/Toolserver:WikiMiniAtlas | WikiMiniAtlas ]] removed.
===== Steps to reproduce problem
1. Go to https://en.wikipedia.org/wiki/Flight_19#PBM-5_(Bureau_Number_59225)
2. If you hover over "29°N 79°W", you will see a little dropdown "WikiMiniAtlas"
3. If you click on "WikiMiniAtlas", an atlas will appear
4. Click "Who Wrote That?"
5. Drop down no longer appears; Atlas will no longer work
6. Close WWT
**Expected behavior:** Atlas will work again
**Observed behavior:** Dropdown does not appear, atlas does not work
==== More examples
- [[ https://en.wikipedia.org/wiki/Help:Collapsing | Collapsible Tables ]] e.g. https://tr.wikipedia.org/wiki/B%C3%BCy%C3%BCk%C5%9Fehir_Belediye_Erzurumspor_2019-20_sezonu#%C4%B0lk_devre
==== Environment
**Browser:** Chromium 73, Firefox 60
**Wiki(s):** https://es.wikipedia.org