Skip to content
This repository was archived by the owner on Jul 13, 2020. It is now read-only.

Commit 5d6b70a

Browse files
committed
support baseURI like about:blank
1 parent 2e44cef commit 5d6b70a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

core/common.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,11 @@ else if (typeof location != 'undefined') {
5050
// sanitize out the hash and querystring
5151
if (baseURI) {
5252
baseURI = baseURI.split('#')[0].split('?')[0];
53-
baseURI = baseURI.substr(0, baseURI.lastIndexOf('/') + 1);
53+
var slashIndex = baseURI.lastIndexOf('/');
54+
if (slashIndex !== -1)
55+
baseURI = baseURI.substr(0, slashIndex + 1);
5456
}
55-
else if (typeof process != 'undefined' && process.cwd) {
57+
else if (typeof process !== 'undefined' && process.cwd) {
5658
baseURI = 'file://' + (isWindows ? '/' : '') + process.cwd();
5759
if (isWindows)
5860
baseURI = baseURI.replace(/\\/g, '/');

0 commit comments

Comments
 (0)