mapbox / mapbox/togeojson

Using togeojson with Electron (17.1.0) causes it to use the incorrect XMLserializer

Open
#176 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.3k
Forks
322
PR merge metrics
No merged PRs in 30d

Description

This section of code (starting line 82 in togeojson.js) causes an XMLserialization error when trying to use it with Electron as the XMLSerializer shows as being defined when it needs to actually use xmldom.

```
var serializer;
if (typeof XMLSerializer !== 'undefined') {
/* istanbul ignore next */
serializer = new XMLSerializer();
// only require xmldom in a node environment
} else if (typeof exports === 'object' && typeof process === 'object' && !process.browser) {
serializer = new (require('xmldom').XMLSerializer)();
}
```

```
Uncaught TypeError: Failed to execute 'serializeToString' on 'XMLSerializer': parameter 1 is not of type 'Node'.
```

Contributor guide

Open the contributing guide

Research direction

Start at togeojson.js around line 82 and inspect how the XMLSerializer is selected when running under Electron. Reproduce the serializeToString error described in the issue, then verify that Electron uses the compatible serializer and no longer reports the Node type mismatch.

Written by the indexing model from the issue text.

Assessment

Tech stack
electron, javascript
Domain
desktop
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.