This repository has been archived by the owner on Mar 13, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use document.location for makeRelPath
document.baseURI is a string, does not have properties like .host
- Loading branch information
Showing
3 changed files
with
29 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,7 +85,7 @@ function resolveRelativeUrl(baseUrl, url) { | |
} | ||
|
||
function makeDocumentRelPath(url) { | ||
var root = document.baseURI; | ||
var root = document.location; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
dfreedm
Author
Contributor
|
||
var u = new URL(url, root); | ||
if (u.host === root.host && u.port === root.port && | ||
u.protocol === root.protocol) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<!-- | ||
Copyright 2013 The Polymer Authors. All rights reserved. | ||
Use of this source code is governed by a BSD-style | ||
license that can be found in the LICENSE file. | ||
--> | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>URL integration test</title> | ||
<script src="../../../tools/test/htmltest.js"></script> | ||
<script src="../../../tools/test/chai/chai.js"></script> | ||
<script src="../../platform.js"></script> | ||
</head> | ||
<body> | ||
<script> | ||
var root = document.location; | ||
var path = '/foo/bar'; | ||
var u = new URL(path, root); | ||
chai.assert.equal(u.host, root.host); | ||
chai.assert.equal(u.port, root.port); | ||
chai.assert.equal(u.protocol, root.protocol); | ||
chai.assert.equal(u.pathname, path); | ||
done(); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this makes the next
if
statement TRUE, and calledmakeRelPath
, butmakeRelPath
droped hash and query of origin url, please add them back whenmakeRelPath