mirror of
https://github.com/videojs/video.js.git
synced 2024-11-24 08:42:25 +02:00
@dmlap fixed URL parsing in IE9. closes #1765
This commit is contained in:
parent
a96978b194
commit
c939ab86ca
@ -8,6 +8,7 @@ CHANGELOG
|
||||
* @anhskohbo added a Vietnamese translation ([view](https://github.com/videojs/video.js/pull/1734))
|
||||
* @Sxmanek added a Czech translation ([view](https://github.com/videojs/video.js/pull/1739))
|
||||
* @jcaron23 added the vjs-scrubbing CSS class and prevented menus from showing while scrubbing ([view](https://github.com/videojs/video.js/pull/1741))
|
||||
* @dmlap fixed URL parsing in IE9 ([view](https://github.com/videojs/video.js/pull/1765))
|
||||
|
||||
--------------------
|
||||
|
||||
|
@ -692,6 +692,15 @@ vjs.parseUrl = function(url) {
|
||||
details[props[i]] = a[props[i]];
|
||||
}
|
||||
|
||||
// IE9 adds the port to the host property unlike everyone else. If
|
||||
// a port identifier is added for standard ports, strip it.
|
||||
if (details.protocol === 'http:') {
|
||||
details.host = details.host.replace(/:80$/, '');
|
||||
}
|
||||
if (details.protocol === 'https:') {
|
||||
details.host = details.host.replace(/:443$/, '');
|
||||
}
|
||||
|
||||
if (addToBody) {
|
||||
document.body.removeChild(div);
|
||||
}
|
||||
|
@ -1,4 +1,13 @@
|
||||
module('Lib');
|
||||
var createElement;
|
||||
|
||||
module('Lib', {
|
||||
'setup': function() {
|
||||
createElement = document.createElement;
|
||||
},
|
||||
'teardown': function() {
|
||||
document.createElement = createElement;
|
||||
}
|
||||
});
|
||||
|
||||
test('should create an element', function(){
|
||||
var div = vjs.createEl();
|
||||
@ -282,6 +291,27 @@ test('should parse the details of a url correctly', function(){
|
||||
equal(vjs.parseUrl('http://example.com:1234').port, '1234', 'parsed example url port');
|
||||
});
|
||||
|
||||
test('should strip port from hosts using http or https', function() {
|
||||
var url;
|
||||
|
||||
// attempts to create elements will return an anchor tag that
|
||||
// misbehaves like IE9
|
||||
document.createElement = function() {
|
||||
return {
|
||||
hostname: 'example.com',
|
||||
host: 'example.com:80',
|
||||
protocol: 'http:',
|
||||
port: '80',
|
||||
pathname: '/domain/relative/url',
|
||||
hash: ''
|
||||
};
|
||||
};
|
||||
|
||||
url = videojs.parseUrl('/domain/relative/url');
|
||||
ok(!(/.*:80$/).test(url.host), ':80 is not appended to the host');
|
||||
});
|
||||
|
||||
|
||||
test('vjs.findPosition should find top and left position', function() {
|
||||
var d = document.createElement('div'),
|
||||
position = vjs.findPosition(d);
|
||||
|
Loading…
Reference in New Issue
Block a user