Page MenuHomePhabricator

ResourceLoader breaks Leaflet library
Closed, InvalidPublicBUG REPORT


When loading the Leaflet library with Resource Loader, the default marker icon does not show properly.

The issue vanishes when putting resource loader in debug mode or when making this modification (based on MW 1.34):

The issue has been present for at least 2 years. (Up till MW 1.34 the Maps extension used a hack to avoid the problem: stuffing an Html::linkedStyle() into the header on top of using the Resouce Loader. This no longer works as of 1.34, though is likely not related to the root cause of the problem.)

Using does not resolve the issue. (Wider context:


Some relevant code:

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptApr 1 2020, 3:56 PM
JeroenDeDauw updated the task description. (Show Details)Apr 1 2020, 3:57 PM
JeroenDeDauw updated the task description. (Show Details)
TheDJ closed this task as Invalid.EditedApr 13 2020, 8:04 PM
TheDJ edited projects, added MediaWiki-ResourceLoader; removed Maps.
TheDJ added a subscriber: TheDJ.

I had sent this by mail as well but, this is not a resourceloader problem.

This is because you have not initialized the L.Icon.Default.imagePath of leaflet markers.
Because of that it falls back to Leaflet's detectIconPath(), which isn't smart enough to handle the myriad of forms of background image css values that are possible with post processing systems these days and does an incorrect rewrite of the url that it retrieves from the processed CSS.

This issue is also known in Leaflet:

Restricted Application added a project: Performance-Team. · View Herald TranscriptApr 13 2020, 8:04 PM
Krinkle renamed this task from Resource Loader breaks Leaflet library to ResourceLoader breaks Leaflet library.Apr 14 2020, 3:28 AM