Skip to content

Commit b45117f

Browse files
committed
Test update to match requirejs/text#119
1 parent 49b7a28 commit b45117f

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

build/tests/lib/moduleThenPlugin/expected.js

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ require(['sub1'], function (sub1) {});
66
define("main", function(){});
77

88
/**
9-
* @license text 2.0.14 Copyright jQuery Foundation and other contributors.
9+
* @license text 2.0.15 Copyright jQuery Foundation and other contributors.
1010
* Released under MIT license, http://github.com/requirejs/text/LICENSE
1111
*/
1212
/*jslint regexp: true */
@@ -28,8 +28,26 @@ define('text',['module'], function (module) {
2828
buildMap = {},
2929
masterConfig = (module.config && module.config()) || {};
3030

31+
function useDefault(value, defaultValue) {
32+
return value === undefined || value === '' ? defaultValue : value;
33+
}
34+
35+
//Allow for default ports for http and https.
36+
function isSamePort(protocol1, port1, protocol2, port2) {
37+
if (port1 === port2) {
38+
return true;
39+
} else if (protocol1 === protocol2) {
40+
if (protocol1 === 'http') {
41+
return useDefault(port1, '80') === useDefault(port2, '80');
42+
} else if (protocol1 === 'https') {
43+
return useDefault(port1, '443') === useDefault(port2, '443');
44+
}
45+
}
46+
return false;
47+
}
48+
3149
text = {
32-
version: '2.0.14',
50+
version: '2.0.15',
3351

3452
strip: function (content) {
3553
//Strips <?xml ...?> declarations so that external SVG and XML
@@ -147,7 +165,7 @@ define('text',['module'], function (module) {
147165

148166
return (!uProtocol || uProtocol === protocol) &&
149167
(!uHostName || uHostName.toLowerCase() === hostname.toLowerCase()) &&
150-
((!uPort && !uHostName) || uPort === port);
168+
((!uPort && !uHostName) || isSamePort(uProtocol, uPort, protocol, port));
151169
},
152170

153171
finishLoad: function (name, strip, content, onLoad) {

0 commit comments

Comments
 (0)