When a feature has wikipedia set to a non-English article, the inspector is unable to display the article’s excerpt and then fails to show any explicitly tagged image.
The feature is tagged wikipedia=pt:Castelo_de_Algoso. This is a perfectly valid tag for the feature (although I would’ve used spaces instead of underscores). wikipedia=* should always begin with a language code prefix. Unfortunately, when sniffing out the Wikipedia link, the inspector sees wikipedia=*, as opposed to wikipedia:xy=*, and assumes it’s in English:
Since the English and Portuguese Wikipedias happen to be on the same server farm, it obliges by returning an interwiki redirect, but it doesn’t have access to the Portuguese Wikipedia database in order to return an extract. Nevertheless, the inspector assumes there is an extract in the response:
Uncaught TypeError: can't access property "textContent", (new DOMParser()).parseFromString(...).getElementsByTagName(...)[0] is undefined
onload openhistoricalmap-inspector.js:607
value openhistoricalmap-inspector.js:605
value openhistoricalmap-inspector.js:331
value openhistoricalmap-inspector.js:77
onload openhistoricalmap-inspector.js:102
value openhistoricalmap-inspector.js:98
value openhistoricalmap-inspector.js:87
value openhistoricalmap-inspector.js:64
n index-32cceb42370ca13698403957a382becf901b1bd43a49db62b2e9b610b78298b1.js:1
o index-32cceb42370ca13698403957a382becf901b1bd43a49db62b2e9b610b78298b1.js:1
i index-32cceb42370ca13698403957a382becf901b1bd43a49db62b2e9b610b78298b1.js:1
i index-32cceb42370ca13698403957a382becf901b1bd43a49db62b2e9b610b78298b1.js:1
setInterval handler*r index-32cceb42370ca13698403957a382becf901b1bd43a49db62b2e9b610b78298b1.js:1
addOpenHistoricalMapTimeSlider index-32cceb42370ca13698403957a382becf901b1bd43a49db62b2e9b610b78298b1.js:1
load index-32cceb42370ca13698403957a382becf901b1bd43a49db62b2e9b610b78298b1.js:1
run index-32cceb42370ca13698403957a382becf901b1bd43a49db62b2e9b610b78298b1.js:11
load index-32cceb42370ca13698403957a382becf901b1bd43a49db62b2e9b610b78298b1.js:11
<anonymous> index-32cceb42370ca13698403957a382becf901b1bd43a49db62b2e9b610b78298b1.js:1
c application-1db896435e361ddc9564449bac4adc0cf20096cf4759b3febd4e9c27af35866b.js:12
p application-1db896435e361ddc9564449bac4adc0cf20096cf4759b3febd4e9c27af35866b.js:12
setTimeout handler*Deferred/then/r/< application-1db896435e361ddc9564449bac4adc0cf20096cf4759b3febd4e9c27af35866b.js:12
u application-1db896435e361ddc9564449bac4adc0cf20096cf4759b3febd4e9c27af35866b.js:12
fireWith application-1db896435e361ddc9564449bac4adc0cf20096cf4759b3febd4e9c27af35866b.js:12
fire application-1db896435e361ddc9564449bac4adc0cf20096cf4759b3febd4e9c27af35866b.js:12
u application-1db896435e361ddc9564449bac4adc0cf20096cf4759b3febd4e9c27af35866b.js:12
fireWith application-1db896435e361ddc9564449bac4adc0cf20096cf4759b3febd4e9c27af35866b.js:12
ready application-1db896435e361ddc9564449bac4adc0cf20096cf4759b3febd4e9c27af35866b.js:12
d application-1db896435e361ddc9564449bac4adc0cf20096cf4759b3febd4e9c27af35866b.js:11
EventListener.handleEvent* application-1db896435e361ddc9564449bac4adc0cf20096cf4759b3febd4e9c27af35866b.js:12
<anonymous> application-1db896435e361ddc9564449bac4adc0cf20096cf4759b3febd4e9c27af35866b.js:11
<anonymous> application-1db896435e361ddc9564449bac4adc0cf20096cf4759b3febd4e9c27af35866b.js:11
openhistoricalmap-inspector.js:607:33
The error prevents any subsequent code from running. This feature happens to have an unnecessary, redundant wikipedia:pt=* tag, but the following code is never reached:
When a feature has
wikipedia
set to a non-English article, the inspector is unable to display the article’s excerpt and then fails to show any explicitly tagged image.Example
This forum post by @nafergo gives the Algoso Castle as an example:
Diagnosis
The feature is tagged
wikipedia=pt:Castelo_de_Algoso
. This is a perfectly valid tag for the feature (although I would’ve used spaces instead of underscores).wikipedia=*
should always begin with a language code prefix. Unfortunately, when sniffing out the Wikipedia link, the inspector seeswikipedia=*
, as opposed towikipedia:xy=*
, and assumes it’s in English:https://github.com/OpenHistoricalMap/ohm-inspector/blob/bf1f3c38dc967a86aa3cdfb5531dc56c4b91a300/openhistoricalmap-inspector.js#L550-L554
Then it asks the English Wikipedia’s API for the article titled “pt:Castelo_de_Algoso”:
https://github.com/OpenHistoricalMap/ohm-inspector/blob/bf1f3c38dc967a86aa3cdfb5531dc56c4b91a300/openhistoricalmap-inspector.js#L601
Since the English and Portuguese Wikipedias happen to be on the same server farm, it obliges by returning an interwiki redirect, but it doesn’t have access to the Portuguese Wikipedia database in order to return an extract. Nevertheless, the inspector assumes there is an extract in the response:
https://github.com/OpenHistoricalMap/ohm-inspector/blob/bf1f3c38dc967a86aa3cdfb5531dc56c4b91a300/openhistoricalmap-inspector.js#L607
This results in an uncaught JavaScript error:
The error prevents any subsequent code from running. This feature happens to have an unnecessary, redundant
wikipedia:pt=*
tag, but the following code is never reached:https://github.com/OpenHistoricalMap/ohm-inspector/blob/bf1f3c38dc967a86aa3cdfb5531dc56c4b91a300/openhistoricalmap-inspector.js#L555-L559
It also has an
image=*
tag, but that code is never reached either.