Skip to content

Commit

Permalink
closes #11
Browse files Browse the repository at this point in the history
  • Loading branch information
GianlucaGuarini committed Apr 4, 2020
1 parent 982c824 commit 0021257
Show file tree
Hide file tree
Showing 5 changed files with 910 additions and 732 deletions.
9 changes: 6 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('riot'), require('bianco.query')) :
typeof define === 'function' && define.amd ? define(['exports', 'riot', 'bianco.query'], factory) :
(global = global || self, factory(global.riotHotReload = {}, global.riot, global.$));
}(this, function (exports, riot, $) { 'use strict';
}(this, (function (exports, riot, $) { 'use strict';

$ = $ && $.hasOwnProperty('default') ? $['default'] : $;
$ = $ && Object.prototype.hasOwnProperty.call($, 'default') ? $['default'] : $;

const { cssManager } = riot.__;
const { DOM_COMPONENT_INSTANCE_PROPERTY } = riot.__.globals;
Expand All @@ -20,6 +20,9 @@
return $(`${name}, [is=${name}]`).map(el => {
const oldTag = el[DOM_COMPONENT_INSTANCE_PROPERTY];

// early return in case there is no riot instance found
if (!oldTag) return

// remove the tag template from the DOM
oldTag.unmount(true);
// delete the old css from the css manager
Expand All @@ -38,4 +41,4 @@

Object.defineProperty(exports, '__esModule', { value: true });

}));
})));
Loading

0 comments on commit 0021257

Please sign in to comment.