Skip to content

Commit

Permalink
fix: cards never show up after they were removed once (#174)
Browse files Browse the repository at this point in the history
* fix: cards never showing up after they were removed once

Bug: If I remove the card of a certain location (eg. New York) and then add it again, it won't show up.
This is due to, the 'hidden' attribute. When I add the location again, the card remains 'hidden'.
I think, removing the DOM element is a clean and expected way to handle this.

* refactor: removing cards

removing the DOM element instead of setting the visibility
  • Loading branch information
marcellkiss authored and petele committed Jul 29, 2019
1 parent 37acb7c commit 44a973b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion public/scripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function addLocation() {
*/
function removeLocation(evt) {
const parent = evt.srcElement.parentElement;
parent.setAttribute('hidden', true);
parent.remove();
if (weatherApp.selectedLocations[parent.id]) {
delete weatherApp.selectedLocations[parent.id];
saveLocationList(weatherApp.selectedLocations);
Expand Down

0 comments on commit 44a973b

Please sign in to comment.