Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
renderjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
renderjs
Commits
9ed53129
Commit
9ed53129
authored
Jan 29, 2020
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Release version 0.22.0
parent
05f1e7de
Pipeline
#7789
passed with stage
in 0 seconds
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
2745 additions
and
8 deletions
+2745
-8
dist/renderjs-0.22.0.js
dist/renderjs-0.22.0.js
+2694
-0
dist/renderjs-latest.js
dist/renderjs-latest.js
+50
-7
package.json
package.json
+1
-1
No files found.
dist/renderjs-0.22.0.js
0 → 100644
View file @
9ed53129
This source diff could not be displayed because it is too large. You can
view the blob
instead.
dist/renderjs-latest.js
View file @
9ed53129
...
...
@@ -2103,7 +2103,8 @@ if (typeof document.contains !== 'function') {
(
new
DOMParser
()).
parseFromString
(
xhr
.
responseText
,
"
text/html
"
);
parsed_html
=
renderJS
.
parseGadgetHTMLDocument
(
tmp_constructor
.
__template_element
,
url
url
,
true
);
for
(
key
in
parsed_html
)
{
if
(
parsed_html
.
hasOwnProperty
(
key
))
{
...
...
@@ -2208,20 +2209,31 @@ if (typeof document.contains !== 'function') {
// renderJS.parseGadgetHTMLDocument
/////////////////////////////////////////////////////////////////
renderJS
.
parseGadgetHTMLDocument
=
function
parseGadgetHTMLDocument
(
document_element
,
url
)
{
function
parseGadgetHTMLDocument
(
document_element
,
url
,
update_relative_url
)
{
var
settings
=
{
title
:
""
,
interface_list
:
[],
required_css_list
:
[],
required_js_list
:
[]
required_js_list
:
[],
path
:
url
},
i
,
element
;
element
,
element_list
,
j
,
url_attribute_list
=
[
'
src
'
,
'
href
'
,
'
srcset
'
],
url_attribute
,
base_found
=
false
;
if
(
!
url
||
!
isAbsoluteOrDataURL
.
test
(
url
))
{
throw
new
Error
(
"
The url should be absolute:
"
+
url
);
}
if
(
update_relative_url
===
undefined
)
{
update_relative_url
=
false
;
}
if
(
document_element
.
nodeType
===
9
)
{
settings
.
title
=
document_element
.
title
;
...
...
@@ -2233,23 +2245,54 @@ if (typeof document.contains !== 'function') {
// element.href returns absolute URL in firefox but "" in chrome;
if
(
element
.
rel
===
"
stylesheet
"
)
{
settings
.
required_css_list
.
push
(
renderJS
.
getAbsoluteURL
(
element
.
getAttribute
(
"
href
"
),
url
)
renderJS
.
getAbsoluteURL
(
element
.
getAttribute
(
"
href
"
),
settings
.
path
)
);
}
else
if
(
element
.
nodeName
===
"
SCRIPT
"
&&
(
element
.
type
===
"
text/javascript
"
||
!
element
.
type
))
{
settings
.
required_js_list
.
push
(
renderJS
.
getAbsoluteURL
(
element
.
getAttribute
(
"
src
"
),
url
)
renderJS
.
getAbsoluteURL
(
element
.
getAttribute
(
"
src
"
),
settings
.
path
)
);
}
else
if
(
element
.
rel
===
"
http://www.renderjs.org/rel/interface
"
)
{
settings
.
interface_list
.
push
(
renderJS
.
getAbsoluteURL
(
element
.
getAttribute
(
"
href
"
),
url
)
renderJS
.
getAbsoluteURL
(
element
.
getAttribute
(
"
href
"
),
settings
.
path
)
);
}
else
if
((
element
.
nodeName
===
"
BASE
"
)
&&
!
base_found
&&
element
.
getAttribute
(
"
href
"
))
{
settings
.
path
=
renderJS
.
getAbsoluteURL
(
element
.
getAttribute
(
"
href
"
),
settings
.
path
);
// Only use the first base element found
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base#Usage_notes
base_found
=
true
;
}
}
}
}
if
(
update_relative_url
&&
(
document_element
.
body
!==
null
))
{
// Resolve all relativeurl configure in the dom as absolute from
// the gadget url
for
(
j
=
0
;
j
<
url_attribute_list
.
length
;
j
+=
1
)
{
url_attribute
=
url_attribute_list
[
j
];
element_list
=
document_element
.
body
.
querySelectorAll
(
'
[
'
+
url_attribute
+
'
]
'
);
for
(
i
=
0
;
i
<
element_list
.
length
;
i
+=
1
)
{
element
=
element_list
[
i
];
element
.
setAttribute
(
url_attribute
,
renderJS
.
getAbsoluteURL
(
element
.
getAttribute
(
url_attribute
),
settings
.
path
));
}
}
}
}
else
{
throw
new
Error
(
"
The first parameter should be an HTMLDocument
"
);
}
...
...
package.json
View file @
9ed53129
{
"name"
:
"renderjs"
,
"version"
:
"0.2
1
.0"
,
"version"
:
"0.2
2
.0"
,
"description"
:
"RenderJs provides HTML5 gadgets"
,
"main"
:
"dist/renderjs-latest.js"
,
"dependencies"
:
{
...
...
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