It would be good to know why you need this, I can hardly imagine what
is this good for.
Anyway, here's how you can do it:

jQuery.fn.find=function( selector ) {
  this.query=selector;  //this is the only line you have to modify

  var elems = jQuery.map(this, function(elem){
    return jQuery.find( selector, elem );
  });
  return this.pushStack( /[^+>] [^+>]/.test( selector ) ||
selector.indexOf("..") > -1 ?
    jQuery.unique( elems ) : elems );
}

Now you can get the query string:
$('body .class').prevObject.query  //->'body .class'
$('body').find('.class').prevObject.prevObject.query  //->'body'
but
$('#id').prevObject.query  //->undefined
$().find('#id').prevObject.query  //->'#id'


On Aug 30, 11:23 pm, Tzury <[EMAIL PROTECTED]> wrote:
> Say a user called $('div.foo') I would like to get this 'div.foo' from
> within my plug-in context.
>
> I look through the code and couldn't find a property which contain
> this data;
>
> I was thinking that 'query' is the appropriate name for this property
>
> example usage:
>
> $.fn.MyPlugIn = function (){
>     if (/table|thead|tbody|th|tr|td/.test($.query){
>         // do the table thing
>     }
>     else {
>        // do the chair thing ;-)
>     }
>
> }
>
> $('table').MyPlugIn();
> $('div').MyPlugIn

Reply via email to