Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
L.Util L.DomUtil is not extensible in leaflet 1.1.0? #5589
Сan not add a custom property to an L.Util or L.DomUtil object since leaflet version 1.1.0:
But it works in 1.0.3 and earlier:
This is a new behavior or ES6 Rollup build result?
Example incompatibility in plugins:
This is a byproduct of the Rollup build. If you look at the built files, you'll find:
This happens because if you code something like this in ES2015...
You can check this by visiting this link to the Rollup REPL
The current situation is that plugins are able to modify Leaflet's namespaces (I'm guilty as charged, as I'm defining
The ""right"" approach would be to either:
referenced this issue
Jun 29, 2017
Since this is a breaking issue with the previous versions of Leaflet, would it make sense to rollback the change temporarily, and issue a console warning or an alert of some sort saying that the ability is depreciated and that it will be removed in the next version? There appears to be numerous published and unpublished plugins which used this feature.
added a commit
Jul 7, 2017
@MuellerMatthew in hindsight, it might have been a bad idea to introduce this change without bumping the major version, as you say this is a breaking change, or at least breaks a pretty common pattern, even though I don't think it has been explicitly documented or supported.
Unfortunately, we are way beyond reverting the ES6 change, it touches an extremely large portion of the source and backing it out would also undo almost all changes we made since 1.0.3.
I think the only way forward is to clearly state that plugins can/should only add methods to real classes, not namespaces.
Thats fine. I think we should probably updated the documentation for plugins then so that we say that for plugins after 1.0.3 there are different rules.
Under the Plugin API title it currently says: