Commit fd432738 authored by Romain Courteaud's avatar Romain Courteaud

Update to renderJS 0.8.0

parent 8cbb0b1a
......@@ -736,6 +736,7 @@ if (typeof document.contains !== 'function') {
loading_klass_promise,
renderJS,
Monitor,
scope_increment = 0,
isAbsoluteOrDataURL = new RegExp('^(?:[a-z]+:)?//|data:', 'i');
/////////////////////////////////////////////////////////////////
......@@ -923,7 +924,7 @@ if (typeof document.contains !== 'function') {
}
function loadSubGadgetDOMDeclaration(g) {
var element_list = g.__element.querySelectorAll('[data-gadget-scope]'),
var element_list = g.__element.querySelectorAll('[data-gadget-url]'),
element,
promise_list = [],
scope,
......@@ -936,7 +937,7 @@ if (typeof document.contains !== 'function') {
scope = element.getAttribute("data-gadget-scope");
url = element.getAttribute("data-gadget-url");
sandbox = element.getAttribute("data-gadget-sandbox");
if ((scope !== null) && (url !== null)) {
if (url !== null) {
promise_list.push(g.declareGadget(url, {
element: element,
scope: scope || undefined,
......@@ -1366,7 +1367,8 @@ if (typeof document.contains !== 'function') {
})
// Set the HTML context
.push(function (gadget_instance) {
var i;
var i,
scope;
// Trigger calling of all ready callback
function ready_wrapper() {
return gadget_instance;
......@@ -1380,11 +1382,18 @@ if (typeof document.contains !== 'function') {
}
// Store local reference to the gadget instance
if (options.scope !== undefined) {
parent_gadget.__sub_gadget_dict[options.scope] = gadget_instance;
gadget_instance.__element.setAttribute("data-gadget-scope",
options.scope);
scope = options.scope;
if (scope === undefined) {
scope = 'RJS_' + scope_increment;
scope_increment += 1;
while (parent_gadget.__sub_gadget_dict.hasOwnProperty(scope)) {
scope = 'RJS_' + scope_increment;
scope_increment += 1;
}
}
parent_gadget.__sub_gadget_dict[scope] = gadget_instance;
gadget_instance.__element.setAttribute("data-gadget-scope",
scope);
// Put some attribute to ease page layout comprehension
gadget_instance.__element.setAttribute("data-gadget-url", url);
......
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>947.5311.8557.33604</string> </value>
<value> <string>951.36791.31778.27426</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1456332463.9</float>
<float>1464706675.31</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -736,6 +736,7 @@ if (typeof document.contains !== 'function') {
loading_klass_promise,
renderJS,
Monitor,
scope_increment = 0,
isAbsoluteOrDataURL = new RegExp('^(?:[a-z]+:)?//|data:', 'i');
/////////////////////////////////////////////////////////////////
......@@ -923,7 +924,7 @@ if (typeof document.contains !== 'function') {
}
function loadSubGadgetDOMDeclaration(g) {
var element_list = g.__element.querySelectorAll('[data-gadget-scope]'),
var element_list = g.__element.querySelectorAll('[data-gadget-url]'),
element,
promise_list = [],
scope,
......@@ -936,7 +937,7 @@ if (typeof document.contains !== 'function') {
scope = element.getAttribute("data-gadget-scope");
url = element.getAttribute("data-gadget-url");
sandbox = element.getAttribute("data-gadget-sandbox");
if ((scope !== null) && (url !== null)) {
if (url !== null) {
promise_list.push(g.declareGadget(url, {
element: element,
scope: scope || undefined,
......@@ -1366,7 +1367,8 @@ if (typeof document.contains !== 'function') {
})
// Set the HTML context
.push(function (gadget_instance) {
var i;
var i,
scope;
// Trigger calling of all ready callback
function ready_wrapper() {
return gadget_instance;
......@@ -1380,11 +1382,18 @@ if (typeof document.contains !== 'function') {
}
// Store local reference to the gadget instance
if (options.scope !== undefined) {
parent_gadget.__sub_gadget_dict[options.scope] = gadget_instance;
gadget_instance.__element.setAttribute("data-gadget-scope",
options.scope);
scope = options.scope;
if (scope === undefined) {
scope = 'RJS_' + scope_increment;
scope_increment += 1;
while (parent_gadget.__sub_gadget_dict.hasOwnProperty(scope)) {
scope = 'RJS_' + scope_increment;
scope_increment += 1;
}
}
parent_gadget.__sub_gadget_dict[scope] = gadget_instance;
gadget_instance.__element.setAttribute("data-gadget-scope",
scope);
// Put some attribute to ease page layout comprehension
gadget_instance.__element.setAttribute("data-gadget-url", url);
......
......@@ -12,7 +12,7 @@
</item>
<item>
<key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts57002898.12</string> </value>
<value> <string>ts64706750.51</string> </value>
</item>
<item>
<key> <string>__name__</string> </key>
......@@ -28,7 +28,7 @@
</item>
<item>
<key> <string>size</string> </key>
<value> <int>76968</int> </value>
<value> <int>77245</int> </value>
</item>
<item>
<key> <string>title</string> </key>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment