http://www.invision-technology.com/devscope/test.php
Here you go.. I didnt take alot of time to do it, just copy pasted some results from php. Hopefully this helps!! Thanks for the help!! James On Jul 17, 1:45 pm, "Brandon Aaron" <[EMAIL PROTECTED]> wrote: > Behavior binds the events (in this case a click event) for you and listens > for "major" DOM modifications (such as adding an element) and binds the > events to new elements that match the selector. In your example the only > thing that changes is the class name. But lets say you made a major DOM > modification too. Behavior would match the new class and bind the 'selected' > click event but the previous event would still be bound also. > > The example you provide would be best written without using behavior at all. > However this is an interesting use-case and I would like to explore it in > more detail. Would you mind providing a complete example for me to dig > through? > > Here is the example written without the use of behavior which should give > you better performance and results. > > $('.codeNumbersRow, .codeNumbersRowSelected').bind('click', function(event) > { > var lineNum = $(this).attr('id').substring(4); > > $(this).toggleClass('codeNumbersRow').toggleClass('codeNumbersRowSelected'); > > $('#code'+lineNum).toggleClass('codeRow').toggleClass('codeRowSelected'); > alert($(this).attr('class')); > > }); > > -- > Brandon Aaron > > On 7/17/07, DXCJames <[EMAIL PROTECTED]> wrote: > > > > > I added "addClass" to the behavior class, so it will recall the > > behaviors when addClass is called.. but they spans start out as > > ".codeNumbersRow" then you click on it and it runs the function turns > > it into ".codeNumbersRowSelected", but for some reason when you try > > and click on it again it runs the ".codeNumbersRow Selected" behavior > > and not the ".codeNumbersRow" one like it is suppose to..?? > > > $(".codeNumbersRow").behavior('click', function() { > > var lineNum = $(this).attr('id').substring(4); > > $ > > (this).removeClass(".codeNumbersRow").addClass("codeNumbersRowSelected"); > > $ > > ("#code"+lineNum).removeClass("codeRow").addClass("codeRowSelected"); > > }); > > > $(".codeNumbersRowSelected").behavior('click', function() { > > var lineNum = $(this).attr('id').substring(4); > > $ > > (this).removeClass("codeNumbersRowSelected").addClass("codeNumbersRow"); > > $ > > ("#code"+lineNum).removeClass("codeRowSelected").addClass("codeRow"); > > alert($(this).attr('class')); > > }); > > > Thanks!! > > > P.S. I also tried taking "addClass" out of the behavior class and just > > put .append() on the end of each function, and the same thing happened.