Making fit.js functional on IE8

HTMLElement doesn't exist in IE8, so swapped in two places for typeof
undefined check and target.nodeType == 1

IE8 uses attachEvent rather than addEventListener
Merge pull request #8 from SignpostMarv/master

Making fit.js functional on IE8