angular/angular.js — pull request #6496 by bbrown (2014-02-28 18:52:54+00:00)
Title: fix($sniffer): add window.document to 'document' assignment search tree

Unit tests were failing for my custom directive that had a text input with an ng-model attribute. The error was that document had no 'createElement' function. Debugging revealed that the document object was using the empty object in the 'document' assignment search tree. Adding window.document prior to that option fixed the issue and I don't think there's any downside to using 'window' here since you're already assuming a browser. There was no functional problem in the usage of my app itself--this only occurred during unit testing in the Karma/Jasmine environment.