Bug Tracker

Changes between Version 2 and Version 3 of Ticket #7220, comment 3


Ignore:
Timestamp:
Oct 22, 2010, 11:05:35 AM (12 years ago)
Author:
cowboy
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #7220, comment 3

    v2 v3  
    1 I threw together this tiny plugin to help debug issues like this:
    2 
    3 {{{
    4 // Log the selector used to select elements to each selected element,
    5 // otherwise to the body. Hover over logged selectors to highlight
    6 // stuff all fancy-like (note: don't select SPAN elements because this
    7 // creates them all over the place!) - Cowboy
    8 
    9 $.fn.logSelector = function() {
    10     var elems = $( '<span>' + this.selector + ' [' + this.length + ']</span>' )
    11         .appendTo( this.length ? this : 'body' );
    12    
    13     this.length && elems.hover(function(e){
    14         elems.parent().andSelf().toggleClass( 'hover', e.type === 'mouseenter' );
    15     });
    16    
    17     return this;
    18 };
    19 }}}
     1I threw together this tiny plugin to help debug issues like this: http://gist.github.com/640714
    202
    213See it in use here: http://jsfiddle.net/cowboy/skGZx/