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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Sven Franck
renderjs
Commits
e78ac402
Commit
e78ac402
authored
Dec 02, 2016
by
Romain Courteaud
🐸
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Speed up getAbsoluteURL
Do not create a DOM document to calculate an URL.
parent
beb63634
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
15 deletions
+6
-15
Gruntfile.js
Gruntfile.js
+2
-1
renderjs.js
renderjs.js
+4
-14
No files found.
Gruntfile.js
View file @
e78ac402
...
...
@@ -67,7 +67,8 @@ module.exports = function (grunt) {
'
FileReader
'
,
'
Node
'
,
'
navigator
'
,
'
Event
'
'
Event
'
,
'
URL
'
]
}
},
...
...
renderjs.js
View file @
e78ac402
...
...
@@ -6,7 +6,7 @@
* http://www.renderjs.org/documentation
*/
(
function
(
document
,
window
,
RSVP
,
DOMParser
,
Channel
,
MutationObserver
,
Node
,
FileReader
,
Blob
,
navigator
,
Event
)
{
Node
,
FileReader
,
Blob
,
navigator
,
Event
,
URL
)
{
"
use strict
"
;
function
readBlobAsDataURL
(
blob
)
{
...
...
@@ -1087,18 +1087,8 @@
// renderJS.getAbsoluteURL
/////////////////////////////////////////////////////////////////
renderJS
.
getAbsoluteURL
=
function
(
url
,
base_url
)
{
var
doc
,
base
,
link
,
html
=
"
<!doctype><html><head></head></html>
"
;
if
(
url
&&
base_url
&&
!
isAbsoluteOrDataURL
.
test
(
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
;
if
(
base_url
&&
url
)
{
return
new
URL
(
url
,
base_url
).
href
;
}
return
url
;
};
...
...
@@ -1682,4 +1672,4 @@
bootstrap
();
}(
document
,
window
,
RSVP
,
DOMParser
,
Channel
,
MutationObserver
,
Node
,
FileReader
,
Blob
,
navigator
,
Event
));
FileReader
,
Blob
,
navigator
,
Event
,
URL
));
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