Answer the question
In order to leave comments, you need to log in
Why is addDomListener needed in Google Maps API?
Hello dear experts! Everything is clear with addListener in Google Maps, it has its own events. But addDomListener serves to handle browser events. The question is simple, why is it needed in the presence of addEventListener , and the presence of jQuery - .on ?
Two very simple examples:
google.maps.event.addDomListener(document.querySelector('a'), 'click', function(e) {
map.setZoom(13);
});
$('a').on('click', function(e) {
map.setZoom(13);
});
Answer the question
In order to leave comments, you need to log in
1) addEventListener doesn't work in old IE. Or do you think that Google maps were written only yesterday? Even at the end of 2016, some projects need to support older browsers.
2) Why do you think that everyone should use jQuery in their projects? If you don't have a link to something, use whatever method works best for your project. If you use jQuery everywhere, hang events via .on(), if you have IE from 9 and don't have jQuery, then see for yourself.
Google's task is to make their maps work everywhere, without any dependencies
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question