document_provider.js 475 B

123456789101112131415161718192021222324252627282930
  1. 'use strict';
  2. /* eslint-env browser */
  3. /*!
  4. * Module dependencies.
  5. */
  6. const Document = require('./document.js');
  7. const BrowserDocument = require('./browserDocument.js');
  8. let isBrowser = false;
  9. /**
  10. * Returns the Document constructor for the current context
  11. *
  12. * @api private
  13. */
  14. module.exports = function() {
  15. if (isBrowser) {
  16. return BrowserDocument;
  17. }
  18. return Document;
  19. };
  20. /*!
  21. * ignore
  22. */
  23. module.exports.setBrowser = function(flag) {
  24. isBrowser = flag;
  25. };