Skip to content

Instantly share code, notes, and snippets.

@akoppela
Created April 22, 2011 03:43
Show Gist options
  • Save akoppela/935974 to your computer and use it in GitHub Desktop.
Save akoppela/935974 to your computer and use it in GitHub Desktop.
getTarget: function(target, anchor) {
if (!target && !(target = this.attributes.target)) return false;
var parsed = this.parseTargetSelector(target);
var results = [];
parsed.each(function(expression) {
if (!anchor) anchor = expression.anchor ? expression.anchor.call(this) : (this.document || document.body);
if (expression.selector) results.push.apply(results, Slick.search(anchor, expression.selector));
else if (anchor) results.push(anchor)
}, this);
return results.length > 0 && results.map(function(result) {
if (result.localName) {
var widget = Element.retrieve(result, 'widget');
if (widget && widget.element == result) return widget
}
return result;
});
},
parseTargetSelector: function(selector) {
if (selector == 'lightbox') return [selector];
return parseTargetSelector.apply(this, arguments);
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment