bitovi/syn — pull request #45 by matthewp (2014-03-17 15:44:40+00:00)
Title: TypeError when Syn loaded in the head (on Syn.schedule)

Syn fails when loaded in the head.

Throws "TypeError: 'undefined' is not an object (evaluating 'Syn.schedule')"

Credit to Ben Demboski for working out what was happening here.

His comments:

The first the checkSupport() does is check for document.body, and if it doesn't exist (which would be the case if you load it from the

tag) then it schedules another call to itself, but it looks like it doesn't include an argument, so the first time it probably gets called with Syn set correctly, but if it then schedules a call back to itself, that call would get undefined for its argument.

So, I'd say either move your scripts into the

tag, or try patching the syn source to:

if (!document.body) {

Syn.schedule(function () { checkSupport(Syn); }, 1);

return;
}