From ec0d28ba875a02af9ae281b9587e78dba6fd5018 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gide=C3=A3o=20Pelegrino=20de=20Abreu?= Date: Thu, 21 Jun 2018 14:47:57 -0300 Subject: [PATCH] Add extra type cast to String To work with numeric data types. Error in Google Chrome 67.0.3396.87 : Uncaught TypeError: d.split is not a function at HTMLOptionElement. (jquery.chained.min.js:2) ... in -> b=d.split(" ") --- jquery.chained.min.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery.chained.min.js b/jquery.chained.min.js index 50a29bc..0aeff57 100644 --- a/jquery.chained.min.js +++ b/jquery.chained.min.js @@ -1,2 +1,2 @@ /*! Chained 2.0.0-beta.3 - MIT license - Copyright 2010-2017 Mika Tuupola */ -!function(a,b,c,d){"use strict";a.fn.chained=function(b){return this.each(function(){function c(){var c=!0,f=a("option:selected",d).val();a(d).html(e.html());var g="";a(b).each(function(){var b=a("option:selected",this).val();b&&(g.length>0&&(g+="+"),g+=b)});var h;h=a.isArray(b)?a(b[0]).first():a(b).first();var i=a("option:selected",h).val();a("option",d).each(function(){if(""!==a(this).val()){var b=[],d=String(a(this).data("chained"));d&&(b=d.split(" ")),b.indexOf(g)>-1||b.indexOf(i)>-1?a(this).val()===f&&(a(this).prop("selected",!0),c=!1):a(this).remove()}}),1===a("option",d).length&&""===a(d).val()?a(d).prop("disabled",!0):a(d).prop("disabled",!1),c&&a(d).trigger("change")}var d=this,e=a(d).clone();a(b).each(function(){a(this).bind("change",function(){c()}),a("option:selected",this).length||a("option",this).first().attr("selected","selected"),c()})})},a.fn.chainedTo=a.fn.chained,a.fn.chained.defaults={}}(window.jQuery||window.Zepto,window,document); \ No newline at end of file +!function(a,b,c,d){"use strict";a.fn.chained=function(b){return this.each(function(){function c(){var c=!0,f=a("option:selected",d).val();a(d).html(e.html());var g="";a(b).each(function(){var b=a("option:selected",this).val();b&&(g.length>0&&(g+="+"),g+=b)});var h;h=a.isArray(b)?a(b[0]).first():a(b).first();var i=a("option:selected",h).val();a("option",d).each(function(){if(""!==a(this).val()){var b=[],d=String(a(this).data("chained"));d&&(b=String(d).split(" ")),b.indexOf(g)>-1||b.indexOf(i)>-1?a(this).val()===f&&(a(this).prop("selected",!0),c=!1):a(this).remove()}}),1===a("option",d).length&&""===a(d).val()?a(d).prop("disabled",!0):a(d).prop("disabled",!1),c&&a(d).trigger("change")}var d=this,e=a(d).clone();a(b).each(function(){a(this).bind("change",function(){c()}),a("option:selected",this).length||a("option",this).first().attr("selected","selected"),c()})})},a.fn.chainedTo=a.fn.chained,a.fn.chained.defaults={}}(window.jQuery||window.Zepto,window,document);