Check for document being in [0] key of $document

I have a factory that calls localStorageService.cookie.clearAll() which throws an error of `TypeError: Cannot read property 'split' of undefined`.  It turns out that this error is caused by $document having document be in `$document[0]`.  The proposed update solves my issue; thanks!