Why parse error

The following gives me parse error so I thought somehow wrong with how I wrote the string in my data-type. I know the problem is in data-type string.

<div class="text" data-period="2000" data-type='["hello", "bye", "sayonara"]'>

window.onload = function () {
        var elements = document.getElementsByClassName('text');
        for (var i = 0; i < elements.length; i++) {
            var toRotate = elements[i].getAttribute('data-type');
            var period = elements[i].getAttribute('data-period');
            if (toRotate) {
                new TxtType(elements[i], JSON.parse(toRotate), period);

running it as a jsFiddle, the only thing I get as an error is Uncaught ReferenceError: TxtType is not defined which is sort of to be expected, as I haven’t created a TxtType class…