Hmmm so how are the changes to either block being made? Is it via user
interaction? Could you track the changes when they are made, that way
you wouldn't need to compare the entire block each time.

You could also try Jeffery's method and filter the HTML through a
regular expression before comparison:

var html1 = $( '#block1' ).html().replace( / jQuery\d+/,'' );

Karl Rudd

On Sat, Mar 29, 2008 at 9:58 PM, domi01 <[EMAIL PROTECTED]> wrote:
>
>  The code with a loop on all elements works fine.
>
>  In fact my problem is the following :
>    I have 2 trees of html : #block1 and #block2
>    I want to know if the 2 blocks are the same (same node names , same
>  attributes, same attribute values, ...).
>
>  The only way I found, is to compare the $('#block1').html() with $
>  ('#block2').html() . It isn't perfect but
>  it is better than nothing. It works fine if the attributes are in the
>  same orders ...
>
>  Concerning JQueryxxxxxx attributes, it should be better to provide a
>  JQuery function to clean up all the
>  html elements that have been tagged using the jquery cache.
>  For each element in the jquery cache, removeData on it.
>  It would be the only efficient way even with large html trees.
>
>  JQuery library is very clean in term of script dependancy, but
>  concerning the html code it could be cleaner.
>  At least it could give a way to make the html clean after jquery
>  calls .
>
>
>
>
>  On 29 mar, 05:29, "Karl Rudd" <[EMAIL PROTECTED]> wrote:
>  > One of the core team might be able to tell you why the attributes are
>  > added for IE, it's probably something to do with some fix for a
>  > bug/feature of IE.
>  >
>  > What are you trying do when you compare the HTML?
>  >
>  > If it's just a small block of code (say contained in a div with
>  > id="block") you could do the replacement with a fair amount of
>  > efficiency:
>  >
>  > $('#block *').each(function() { $.removeData(this) });
>  >
>  > If it's a larger block of code then perhaps you could rethink what or
>  > how you're comparing.
>  >
>  > Karl Rudd
>  >
>
>
> > On Sat, Mar 29, 2008 at 9:15 AM, domi01 <[EMAIL PROTECTED]> wrote:
>  >
>  > >  The .removeData(elem) works if you have the HTML element with the
>  > >  jQueryxxxxxxxxxxx attribute.
>  > >  In my case I don't know those elements .
>  >
>  > >  I could make a loop on all the elements and calls the function in
>  > >  order to remove those tags.
>  > >  This process won't be efficient.
>  >
>  > >  In my case, the problem occurs only with IE. With Firefox the
>  > >   attributes jQueryxxxxxxxxxx are not added.
>

Reply via email to