mapbox-gl-inspect
mapbox-gl-inspect copied to clipboard
Plugin recognizes DOM node type only as 'undefined.'
While using the plugin after adding it to a layer of point geometry type, we observed that the user would click on a point, but the hover would not appear. The plugin checks the type of the object it attempts to add to as a parent. If it's of type 'string', then it adds the hover as HTML. Otherwise as a DOM content (near line 216 of MaboxInspect.js).
Only after allowing for a type of 'undefined' could the popup actually be added to the data structure by invoking this._popup.setHTML(). So the new proposed code would be
if (type === 'string' || type === 'undefined') { this._popup.setHTML(this.options.renderPopup(features)); } else { this._popup.setDOMContent(this.options.renderPopup(features)); }