Cannot read property 'innerText' of undefined at updatePopup
szmalec opened this issue · 0 comments
Hello.
I would like to report problem which occurs in specific scenario. I have prepared plunker which shows where problem is (in plunker click button "Test #2 (ERROR)" and then click red marker)... As stated in this issue title "Cannot read property 'innerText' of undefined at updatePopup" error occurs. It occurs only if marker message is div with ng-include directive AND marker focus property is false AND when we change marker icon in marker click handler. There is no problem if focus property has true value... There is also no problem when message does not contain ng-include directive but is normal text...
Problem is in the same line as in #841. Fast fix for problem reported here is one line of code:
if (marker._popup._contentNode === undefined)
return;
but I don't know if it is good solution... Maybe root cause is somewhere in code which leads to state when marker._popup._contentNode === undefined
// Update the icon property
if (!isObject(markerData.icon)) {
// If there is no icon property or it's not an object
if (isObject(oldMarkerData.icon)) {
// If there was an icon before restore to the default
marker.setIcon(createLeafletIcon());
marker.closePopup();
marker.unbindPopup();
if (isString(markerData.message)) {
marker.bindPopup(markerData.message, markerData.popupOptions);
}
}
}
Can you apply fix for described scenario?