Commit 0ab5cb9e authored by Romain Courteaud's avatar Romain Courteaud

Release version 0.8.0

parent 11ed2094
This diff is collapsed.
This diff is collapsed.
...@@ -736,6 +736,7 @@ if (typeof document.contains !== 'function') { ...@@ -736,6 +736,7 @@ if (typeof document.contains !== 'function') {
loading_klass_promise, loading_klass_promise,
renderJS, renderJS,
Monitor, Monitor,
scope_increment = 0,
isAbsoluteOrDataURL = new RegExp('^(?:[a-z]+:)?//|data:', 'i'); isAbsoluteOrDataURL = new RegExp('^(?:[a-z]+:)?//|data:', 'i');
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
...@@ -923,7 +924,7 @@ if (typeof document.contains !== 'function') { ...@@ -923,7 +924,7 @@ if (typeof document.contains !== 'function') {
} }
function loadSubGadgetDOMDeclaration(g) { function loadSubGadgetDOMDeclaration(g) {
var element_list = g.__element.querySelectorAll('[data-gadget-scope]'), var element_list = g.__element.querySelectorAll('[data-gadget-url]'),
element, element,
promise_list = [], promise_list = [],
scope, scope,
...@@ -936,7 +937,7 @@ if (typeof document.contains !== 'function') { ...@@ -936,7 +937,7 @@ if (typeof document.contains !== 'function') {
scope = element.getAttribute("data-gadget-scope"); scope = element.getAttribute("data-gadget-scope");
url = element.getAttribute("data-gadget-url"); url = element.getAttribute("data-gadget-url");
sandbox = element.getAttribute("data-gadget-sandbox"); sandbox = element.getAttribute("data-gadget-sandbox");
if ((scope !== null) && (url !== null)) { if (url !== null) {
promise_list.push(g.declareGadget(url, { promise_list.push(g.declareGadget(url, {
element: element, element: element,
scope: scope || undefined, scope: scope || undefined,
...@@ -1366,7 +1367,8 @@ if (typeof document.contains !== 'function') { ...@@ -1366,7 +1367,8 @@ if (typeof document.contains !== 'function') {
}) })
// Set the HTML context // Set the HTML context
.push(function (gadget_instance) { .push(function (gadget_instance) {
var i; var i,
scope;
// Trigger calling of all ready callback // Trigger calling of all ready callback
function ready_wrapper() { function ready_wrapper() {
return gadget_instance; return gadget_instance;
...@@ -1380,11 +1382,18 @@ if (typeof document.contains !== 'function') { ...@@ -1380,11 +1382,18 @@ if (typeof document.contains !== 'function') {
} }
// Store local reference to the gadget instance // Store local reference to the gadget instance
if (options.scope !== undefined) { scope = options.scope;
parent_gadget.__sub_gadget_dict[options.scope] = gadget_instance; if (scope === undefined) {
gadget_instance.__element.setAttribute("data-gadget-scope", scope = 'RJS_' + scope_increment;
options.scope); 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 // Put some attribute to ease page layout comprehension
gadget_instance.__element.setAttribute("data-gadget-url", url); gadget_instance.__element.setAttribute("data-gadget-url", url);
......
This diff is collapsed.
{ {
"name": "renderjs", "name": "renderjs",
"version": "0.7.5", "version": "0.8.0",
"description": "RenderJs provides HTML5 gadgets", "description": "RenderJs provides HTML5 gadgets",
"main": "dist/renderjs-latest.js", "main": "dist/renderjs-latest.js",
"dependencies": { "dependencies": {
......
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