if no args, get all components of that type

v1.18.x
psychobunny 10 years ago
parent 567d171d2f
commit 901cb92941

@ -5,7 +5,7 @@ var components = components || {};
(function() { (function() {
components.core = { components.core = {
'post': function(name, value) { 'post': function(name, value) {
return value ? $('[data-' + name + '="' + value + '"]') $('[data-' + name + ']'); return $('[data-' + name + '="' + value + '"]');
}, },
'post/content': function(pid) { 'post/content': function(pid) {
var el = components.core.post('pid', pid).find('[component="post/content"]'); var el = components.core.post('pid', pid).find('[component="post/content"]');
@ -24,7 +24,7 @@ var components = components || {};
components.get = function() { components.get = function() {
var args = Array.prototype.slice.call(arguments, 1); var args = Array.prototype.slice.call(arguments, 1);
if (components.core[arguments[0]]) { if (components.core[arguments[0]] && args.length) {
return components.core[arguments[0]].apply(this, args); return components.core[arguments[0]].apply(this, args);
} else { } else {
return $('[component="' + arguments[0] + '"]'); return $('[component="' + arguments[0] + '"]');

Loading…
Cancel
Save