Closed yeslad closed 6 years ago
Solution nr 2 will not work when data will be null since null have no method toString()
better:
const data = $elem.data("chained"); if (data) { matches = data.toString().split(" "); }
Any news about this bug?
Sorry I duplicated this bug here: https://github.com/tuupola/jquery_chained/issues/67
This line assumes that the value of
data-chained
is a String. However, as per jQuery docs (behavior of Zepto is similar):Since
Number
does not have a.split()
method, the script fails at this point if data-chained is a number.Two solutions are:
.attr('data-chained')
which will always return a stringvar data = $(this).data("chained").toString()