Compare commits

...

1 Commits

Author SHA1 Message Date
Joe Cheng
9b619353a4 wip 2014-06-30 21:53:29 -07:00

View File

@@ -1058,7 +1058,10 @@
(function() {
// Returns a jQuery object or element array that contains the
// descendants of scope that match this binding
this.find = function(scope) { throw "Not implemented"; };
this.find = function(scope) {
if (typeof(this.className) !== 'undefined')
return $(scope).find('.' + this.className);
};
this.getId = function(el) {
return el['data-input-id'] || el.id;
@@ -1250,6 +1253,7 @@
exports.renderHtml(html, el, dependencies);
exports.initializeInputs(el);
exports.initializeOutputs(el);
exports.bindAll(el);
}
});
@@ -2991,14 +2995,10 @@
};
exports.unbindAll = unbindAll;
// Calls .initialize() for all of the input objects in all input bindings,
// in the given scope.
function initializeInputs(scope) {
function initializeElements(scope, bindings) {
if (scope === undefined)
scope = document;
var bindings = inputBindings.getBindings();
// Iterate over all bindings
for (var i = 0; i < bindings.length; i++) {
var binding = bindings[i].binding;
@@ -3010,11 +3010,24 @@
}
}
}
// Calls .initialize() for all of the input objects in all input bindings,
// in the given scope.
function initializeInputs(scope) {
initializeElements(scope, inputBindings.getBindings());
}
exports.initializeInputs = initializeInputs;
// Calls .initialize() for all of the output objects in all output bindings,
// in the given scope.
function initializeOutputs(scope) {
initializeElements(scope, outputBindings.getBindings());
}
exports.initializeOutputs = initializeOutputs;
// Initialize all input objects in the document, before binding
initializeInputs(document);
initializeOutputs(document);
// Binding multiInputs in this method is useful for old-style (<=0.5.0)
// HTML generated by Shiny. This should be deprecated at some point.