-
Notifications
You must be signed in to change notification settings - Fork 322
MapData events not being cleared #313
Copy link
Copy link
Closed
Labels
Description
Currently, mouseover/mouseout/touchstart & touchend events are not being cleared when clearEvents is called on MapData.
In PR #248, support for touch events was added (touchstart.mapster & touchend.mapster), however the bind was modified to add these new events to the existing mouseover.mapster & mouseout.mapster separated by a comma.
This presents issues when clearEvents is called since that code relies on the namespace .mapster to clear all events, however the expected format for bind is space-delimited vs. comma-delimited. This results in not all events being cleared when $(selector).mapster('unbind') is called leaving the events bound to orphaned elements.
A couple of ways to reproduce the issue/behavior:
- Using example
- Clone Repo
- Open /examples/usa.html
- hover over map and see expected behavior of states being "highlighted"
- In developer tools console, execute
$("#usa_image").mapster('unbind') - hover over map and you'll see the errors like the following in developer tools console:
mapdata.js:475 Uncaught TypeError: Cannot read property '20' of null
at m.MapData.getAllDataForArea (mapdata.js:475)
at HTMLAreaElement.mouseover (mapdata.js:146)
at HTMLAreaElement.me.mouseover (mapdata.js:359)
at HTMLAreaElement.dispatch (jquery.js:3256)
at HTMLAreaElement.eventHandle (jquery.js:2875)
- Running tests
- Clone Repo
- Open /tests/imagemapster-test-runner.html
- Click "select all"
- Select "run tests" -> The "events" group and "tooltips" groups will fail as follows:
Starting test group "events": Failed
Starting test "Mouse Events": Failed
Test #1 assert.resolves failed : Error: timed out in test "The last test was run"
Test #1 assert.resolves failed : Error: timed out in test "The last test was run"
The test was stopped because an assertion failed.. Debugging is enabled if you start again.
1 assertions passed.
Starting test group "tooltips": Failed
Starting test "Imagemap tooltips": Failed
An error occurred in your test code: TypeError: Cannot read property '31' of null. Debugging is enabled if you start again.
1 assertions passed.
Reactions are currently unavailable