diff --git a/lc_switch.js b/lc_switch.js
index 22d7e1f..55b37e9 100644
--- a/lc_switch.js
+++ b/lc_switch.js
@@ -2,7 +2,7 @@
* LC Switch
* superlight pure javascript plugin improving forms look and functionality
*
- * @version: 2.0.2
+ * @version: 2.0.3
* @author: Luca Montanari (LCweb)
* @website: https://lcweb.it
@@ -258,8 +258,8 @@
// trigger events
if(!forced_action) {
- const lcsOnEvent = new Event("lcs-on"),
- lcsStatusChangeEvent = new Event('lcs-statuschange');
+ const lcsOnEvent = new Event("lcs-on", {bubbles:true}),
+ lcsStatusChangeEvent = new Event('lcs-statuschange', {bubbles:true});
el.dispatchEvent(lcsOnEvent);
el.dispatchEvent(lcsStatusChangeEvent);
@@ -294,8 +294,8 @@
// trigger events
if(!forced_action) {
- const lcsOffEvent = new Event("lcs-off"),
- lcsStatusChangeEvent = new Event('lcs-statuschange');
+ const lcsOffEvent = new Event("lcs-off", {bubbles:true}),
+ lcsStatusChangeEvent = new Event('lcs-statuschange', {bubbles:true});
el.dispatchEvent(lcsOffEvent);
el.dispatchEvent(lcsStatusChangeEvent);
@@ -335,8 +335,8 @@
el.previousElementSibling.classList.add('lcs_disabled');
// trigger events
- const lcsDisabledEvent = new Event("lcs-disabled"),
- lcsStatusChangeEvent = new Event('lcs-statuschange');
+ const lcsDisabledEvent = new Event("lcs-disabled", {bubbles:true}),
+ lcsStatusChangeEvent = new Event('lcs-statuschange', {bubbles:true});
el.dispatchEvent(lcsDisabledEvent);
el.dispatchEvent(lcsStatusChangeEvent);
@@ -357,8 +357,8 @@
el.previousElementSibling.classList.remove('lcs_disabled');
// trigger events
- const lcsEnabledEvent = new Event("lcs-enabled"),
- lcsStatusChangeEvent = new Event('lcs-statuschange');
+ const lcsEnabledEvent = new Event("lcs-enabled", {bubbles:true}),
+ lcsStatusChangeEvent = new Event('lcs-statuschange', {bubbles:true});
el.dispatchEvent(lcsEnabledEvent);
el.dispatchEvent(lcsStatusChangeEvent);
diff --git a/lc_switch.min.js b/lc_switch.min.js
index 328fa2b..9c727a2 100644
--- a/lc_switch.min.js
+++ b/lc_switch.min.js
@@ -2,7 +2,7 @@
* LC Switch
* superlight pure javascript plugin improving forms look and functionality
*
- * @version: 2.0.2
+ * @version: 2.0.3
* @author: Luca Montanari (LCweb)
* @website: https://lcweb.it
@@ -13,8 +13,8 @@ var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.createTemplateTagFirstArg=funct
(function(h){if("undefined"!=typeof Element.prototype.lc_switch)return!1;var e=!1,p={on_txt:"ON",off_txt:"OFF",on_color:!1,compact_mode:!1},q=!1;window.lc_switch=function(c,a){a="object"!=typeof a?p:Object.assign({},p,a);f(c).forEach(function(b){if(!("INPUT"!=b.tagName||"INPUT"==b.tagName&&"checkbox"!=b.getAttribute("type")&&"radio"!=b.getAttribute("type")||b.parentNode.classList.length&&b.parentNode.classList.contains("lcs_wrap"))){var d=a.on_txt?'
'+a.on_txt+"
":
"",m=a.off_txt?''+a.off_txt+"
":"",n="lcs_"+b.getAttribute("type");n+=b.checked?" lcs_on":" lcs_off";b.disabled&&(n+=" lcs_disabled");var t=a.on_color&&b.checked?'style="background: '+a.on_color+';"':"",u=a.on_color?'data-on-color="'+a.on_color+'"':"",k=document.createElement("div");k.classList.add("lcs_wrap");k.innerHTML='";a.compact_mode&&k.classList.add("lcs_compact");
b.parentNode.insertBefore(k,b);k.appendChild(b);k.querySelector(".lcs_switch").addEventListener("click",function(l){(l.target.classList.contains("lcs_switch")?l.target:r(l.target,".lcs_switch")).classList.contains("lcs_disabled")||lcs_toggle(b)});b.addEventListener("change",function(l){lcs_update(b)})}});q||(q=!0,document.head.insertAdjacentHTML("beforeend",''))};
-window.lcs_destroy=function(c){f(c).forEach(function(a){g(a)&&a.parentNode.replaceWith(a)})};window.lcs_on=function(c){f(c).forEach(function(a){if(g(a)&&(!a.checked||e)){"radio"==a.getAttribute("type")&&lcs_off(r(a,"form").querySelectorAll('input[name="'+a.getAttribute("name")+'"]'),!0);a.checked=!0;var b=a.previousElementSibling;b.classList.add("lcs_on");b.classList.remove("lcs_off");b.getAttribute("data-on-color")&&(b.style.background=b.getAttribute("data-on-color"));if(!e){b=new Event("lcs-on");
-var d=new Event("lcs-statuschange");a.dispatchEvent(b);a.dispatchEvent(d)}}})};window.lcs_off=function(c,a){f(c).forEach(function(b){if(g(b)&&(b.checked||e)&&("radio"!=b.getAttribute("type")||a||e)){b.checked=!1;var d=b.previousElementSibling;d.classList.add("lcs_off");d.classList.remove("lcs_on");d.getAttribute("data-on-color")&&(d.style.background=null);if(!e){d=new Event("lcs-off");var m=new Event("lcs-statuschange");b.dispatchEvent(d);b.dispatchEvent(m)}}})};window.lcs_toggle=function(c){f(c).forEach(function(a){g(a)&&
-("radio"==a.getAttribute("type")&&a.checked||(a.checked?lcs_off(a):lcs_on(a)))})};window.lcs_disable=function(c){f(c).forEach(function(a){if(g(a)&&(!a.disabled||e)){a.disabled=!0;a.previousElementSibling.classList.add("lcs_disabled");var b=new Event("lcs-disabled"),d=new Event("lcs-statuschange");a.dispatchEvent(b);a.dispatchEvent(d)}})};window.lcs_enable=function(c){f(c).forEach(function(a){if(g(a)&&(a.disabled||e)){a.disabled=!1;a.previousElementSibling.classList.remove("lcs_disabled");var b=new Event("lcs-enabled"),
-d=new Event("lcs-statuschange");a.dispatchEvent(b);a.dispatchEvent(d)}})};window.lcs_update=function(c){f(c).forEach(function(a){g(a)&&(e=!0,a.checked?lcs_on(a):lcs_off(a),a.disabled?lcs_disable(a):lcs_enable(a),e=!1)})};var f=function(c){if("string"!=typeof c)return c instanceof Element?[c]:Object.values(c);(c.match(/(#[0-9][^\s:,]*)/g)||[]).forEach(function(a){c=c.replace(a,'[id="'+a.replace("#","")+'"]')});return document.querySelectorAll(c)},g=function(c){return"INPUT"!=c.tagName||"INPUT"==c.tagName&&
-"checkbox"!=c.getAttribute("type")&&"radio"!=c.getAttribute("type")||!c.parentNode.classList.length||c.parentNode.classList.length&&!c.parentNode.classList.contains("lcs_wrap")?!1:!0},r=function(c,a){for(var b=c;null!=b.parentNode&&!b.matches(a);)b=b.parentNode;return b}})();
\ No newline at end of file
+window.lcs_destroy=function(c){f(c).forEach(function(a){g(a)&&a.parentNode.replaceWith(a)})};window.lcs_on=function(c){f(c).forEach(function(a){if(g(a)&&(!a.checked||e)){"radio"==a.getAttribute("type")&&lcs_off(r(a,"form").querySelectorAll('input[name="'+a.getAttribute("name")+'"]'),!0);a.checked=!0;var b=a.previousElementSibling;b.classList.add("lcs_on");b.classList.remove("lcs_off");b.getAttribute("data-on-color")&&(b.style.background=b.getAttribute("data-on-color"));if(!e){b=new Event("lcs-on",
+{bubbles:!0});var d=new Event("lcs-statuschange",{bubbles:!0});a.dispatchEvent(b);a.dispatchEvent(d)}}})};window.lcs_off=function(c,a){f(c).forEach(function(b){if(g(b)&&(b.checked||e)&&("radio"!=b.getAttribute("type")||a||e)){b.checked=!1;var d=b.previousElementSibling;d.classList.add("lcs_off");d.classList.remove("lcs_on");d.getAttribute("data-on-color")&&(d.style.background=null);if(!e){d=new Event("lcs-off",{bubbles:!0});var m=new Event("lcs-statuschange",{bubbles:!0});b.dispatchEvent(d);b.dispatchEvent(m)}}})};
+window.lcs_toggle=function(c){f(c).forEach(function(a){g(a)&&("radio"==a.getAttribute("type")&&a.checked||(a.checked?lcs_off(a):lcs_on(a)))})};window.lcs_disable=function(c){f(c).forEach(function(a){if(g(a)&&(!a.disabled||e)){a.disabled=!0;a.previousElementSibling.classList.add("lcs_disabled");var b=new Event("lcs-disabled",{bubbles:!0}),d=new Event("lcs-statuschange",{bubbles:!0});a.dispatchEvent(b);a.dispatchEvent(d)}})};window.lcs_enable=function(c){f(c).forEach(function(a){if(g(a)&&(a.disabled||
+e)){a.disabled=!1;a.previousElementSibling.classList.remove("lcs_disabled");var b=new Event("lcs-enabled",{bubbles:!0}),d=new Event("lcs-statuschange",{bubbles:!0});a.dispatchEvent(b);a.dispatchEvent(d)}})};window.lcs_update=function(c){f(c).forEach(function(a){g(a)&&(e=!0,a.checked?lcs_on(a):lcs_off(a),a.disabled?lcs_disable(a):lcs_enable(a),e=!1)})};var f=function(c){if("string"!=typeof c)return c instanceof Element?[c]:Object.values(c);(c.match(/(#[0-9][^\s:,]*)/g)||[]).forEach(function(a){c=c.replace(a,
+'[id="'+a.replace("#","")+'"]')});return document.querySelectorAll(c)},g=function(c){return"INPUT"!=c.tagName||"INPUT"==c.tagName&&"checkbox"!=c.getAttribute("type")&&"radio"!=c.getAttribute("type")||!c.parentNode.classList.length||c.parentNode.classList.length&&!c.parentNode.classList.contains("lcs_wrap")?!1:!0},r=function(c,a){for(var b=c;null!=b.parentNode&&!b.matches(a);)b=b.parentNode;return b}})();
\ No newline at end of file
diff --git a/package.json b/package.json
index f286aa8..ea755d6 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"author": "LCweb",
"name": "lc-switch",
- "version": "2.0.2",
+ "version": "2.0.3",
"description": "Superlight vanilla javascript plugin improving forms look and functionality",
"keywords": [
"javascript",