Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
renderjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Romain Courteaud
renderjs
Commits
7171391d
Commit
7171391d
authored
Jan 17, 2018
by
Tristan Cavelier
Committed by
Romain Courteaud
Jan 17, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
URL polyfill for IE.
parent
99929f72
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
0 deletions
+52
-0
lib/iefix/url.js
lib/iefix/url.js
+52
-0
No files found.
lib/iefix/url.js
0 → 100644
View file @
7171391d
(
function
(
DOMParser
)
{
"
use strict
"
;
try
{
if
((
new
window
.
URL
(
"
../a
"
,
"
https://example.com/
"
)).
href
===
"
https://example.com/a
"
)
{
return
;
}
}
catch
(
ignore
)
{}
var
isAbsoluteOrDataURL
=
/^
(?:[
a-z
]
+:
)?\/\/
|data:/i
;
function
resolveUrl
(
url
,
base_url
)
{
var
doc
,
base
,
link
,
html
=
"
<!doctype><html><head></head></html>
"
;
if
(
url
&&
base_url
)
{
doc
=
(
new
DOMParser
()).
parseFromString
(
html
,
'
text/html
'
);
base
=
doc
.
createElement
(
'
base
'
);
link
=
doc
.
createElement
(
'
link
'
);
doc
.
head
.
appendChild
(
base
);
doc
.
head
.
appendChild
(
link
);
base
.
href
=
base_url
;
link
.
href
=
url
;
return
link
.
href
;
}
return
url
;
}
function
URL
(
url
,
base
)
{
if
(
base
!==
undefined
)
{
if
(
!
isAbsoluteOrDataURL
.
test
(
base
))
{
throw
new
TypeError
(
"
Failed to construct 'URL': Invalid base URL
"
);
}
url
=
resolveUrl
(
url
,
base
);
}
if
(
!
isAbsoluteOrDataURL
.
test
(
url
))
{
throw
new
TypeError
(
"
Failed to construct 'URL': Invalid URL
"
);
}
this
.
href
=
url
;
}
URL
.
prototype
.
href
=
""
;
if
(
window
.
URL
&&
window
.
URL
.
createObjectURL
)
{
URL
.
createObjectURL
=
window
.
URL
.
createObjectURL
;
}
if
(
window
.
URL
&&
window
.
URL
.
revokeObjectURL
)
{
URL
.
revokeObjectURL
=
window
.
URL
.
revokeObjectURL
;
}
window
.
URL
=
URL
;
}(
DOMParser
));
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment