0

I unfortunately need to have a leaflet-dvf app that uses Chart Markers that needs to also work in IE 11. It works fine in Chrome and Firefox. The markers example here doesn't render in IE 11 either:

http://humangeo.github.io/leaflet-dvf/examples/html/markers.html

Is there a workaround ? I tried added the meta X-UA-Compatible IE=edge to my app but that doesn't seem to help.

Stranded Kid
  • 1,395
  • 3
  • 15
  • 23
Brad
  • 823
  • 1
  • 9
  • 17

2 Answers2

1

The fact it doesn't work in IE is because the custom SVG markers are an experimental feature (it's written in source code), and the error comes from

var children = gradient.children;
var childLength = children.length; // Cannot read property length of undefined, line 2739 of the file

So the only solution at the moment is to modify yourself the source code. The gradient is just a gradient SVG element.

I guess that's because IE does not support children property on DOM elements, but instead you should try to use the childNodes property.

var children = gradient.childNodes;
var childLength = children.length;

I can't test it right now but it might do the trick, or perhaps you will go around these step and find a further issue with IE. Just note that childNodes is different from children because it returns all the nodes of an element, and not just the elements of it, so the length will differ.

See here.

If you don't want to get your hands dirty by debugging the code step by step to make it work on IE (even if I think it's just a little effort to do), use a DOM Shim like this and it will get rid of the issues you face.

Community
  • 1
  • 1
Stranded Kid
  • 1,395
  • 3
  • 15
  • 23
  • Thanks I'm fairly new at SVG and other drawing techniques so I appreciate you giving me a place to start. – Brad Dec 17 '15 at 23:40
1

One of the project authors here.

This issue should be fixed in the 1.0dev branch (compatible with Leaflet 1.0), but I'll make the same fix in the master branch and push that up. Thanks for pointing this out!

Remi Guan
  • 21,506
  • 17
  • 64
  • 87
  • Stack Overflow is not for bug reports. –  Jan 01 '16 at 03:26
  • Not sure why this is flagged as low quality. As the project author, I noticed that someone had questions/issues with my project. By making fixes to the library that the initial poster had questions about, doesn't that help to answer the poster's question by giving the initial poster more information? – sfairgrieve Jan 13 '16 at 00:47
  • If the issue in the question is no longer reproducible, the question should be closed as no longer reproducible. Bug reports should be handled on your project's bug tracker, wherever that may be. –  Jan 13 '16 at 01:09