|
2 | 2 | 'use strict';
|
3 | 3 |
|
4 | 4 | /** Object shortcuts */
|
5 |
| - var phantom = root.phantom, |
| 5 | + var amd = root.define && define.amd, |
| 6 | + phantom = root.phantom, |
6 | 7 | process = root.process,
|
7 | 8 | system = root.system;
|
8 | 9 |
|
|
27 | 28 | result = (result.length > min && !/test(?:\.js)?$/.test(last)) ? last : '../lodash.js';
|
28 | 29 |
|
29 | 30 | try {
|
30 |
| - if (typeof define == 'undefined') { |
| 31 | + if (!amd) { |
31 | 32 | return require('fs').realpathSync(result);
|
32 | 33 | }
|
33 | 34 | } catch(e) { }
|
|
51 | 52 | if (phantom && isModularize) {
|
52 | 53 | var page = require('webpage').create();
|
53 | 54 | page.open(filePath, function(status) {
|
54 |
| - if (status !== 'success') { |
| 55 | + if (status != 'success') { |
55 | 56 | console.log('PhantomJS failed to load page: ' + filePath);
|
56 | 57 | phantom.exit(1);
|
57 | 58 | }
|
|
68 | 69 | page.onInitialized = function() {
|
69 | 70 | page.evaluate(function() {
|
70 | 71 | document.addEventListener('DOMContentLoaded', function() {
|
71 |
| - var xhr = new XMLHttpRequest; |
72 |
| - xhr.open('GET', '../vendor/qunit-clib/qunit-clib.js'); |
73 |
| - xhr.onload = function() { |
74 |
| - var script = document.createElement('script'); |
75 |
| - script.text = xhr.responseText; |
76 |
| - document.head.appendChild(script); |
77 |
| - QUnit.done(callPhantom); |
78 |
| - }; |
79 |
| - |
80 |
| - xhr.send(null); |
81 |
| - }, false); |
| 72 | + var script = document.createElement('script'); |
| 73 | + script.src = '../vendor/qunit-clib/qunit-clib.js'; |
| 74 | + document.head.appendChild(script); |
| 75 | + QUnit.done(callPhantom); |
| 76 | + }); |
82 | 77 | });
|
83 | 78 | };
|
84 | 79 |
|
|
89 | 84 |
|
90 | 85 | /** Method and object shortcuts */
|
91 | 86 | var document = !phantom && root.document,
|
92 |
| - amd = root.define && define.amd, |
93 | 87 | body = document && document.body,
|
94 | 88 | create = Object.create,
|
95 | 89 | freeze = Object.freeze,
|
96 | 90 | push = Array.prototype.push,
|
97 | 91 | slice = Array.prototype.slice,
|
98 | 92 | toString = Object.prototype.toString,
|
99 |
| - Worker = !phantom && root.Worker; |
| 93 | + Worker = document && root.Worker; |
100 | 94 |
|
101 | 95 | /** Detects if running in a PhantomJS web page */
|
102 | 96 | var isPhantomPage = typeof callPhantom == 'function';
|
|
0 commit comments