Well there is defiantly an issue and i can tell you what is it.  When the
item is cloned the ID is staying with it even though the actual ID attribute
is updated, according to the DOM it does not change. I can confirm this
because after the item is injected the id that is returned from the injected
element is still the original id from the cloned element but the id in the
actual code has been updated

 

The IE version i was testing this on it version 6.0.3790.3959 in Service
Pack 2

 

This works...

<script type="text/javascript" charset="utf-8">

      document.addEvent('domready', function(){

            cloned = new Element($('cloneMe').get("tag"), {"id":
"sauce"}).set("html",
$('cloneMe').get("html")).inject($('cloneMe').parentNode, "top");

            alert(cloned.getParent().get("html"));

            });

      function getSauce() {

            var el = $(document.body).getElements("div")[0];

            alert(el.get('id') + "\n" + el.get("text"));

            }

</script>

<input type="button" onclick="getSauce()" value="get sauce" />

 

 

This does not work...

<script type="text/javascript" charset="utf-8">

      document.addEvent('domready', function(){

            cloned = $('cloneMe').clone();

            cloned.set('id', 'sauce').set("text", "the cloned
one").inject($('cloneMe').parentNode, "top");

            alert(cloned.getParent().get("html"));

            });

function getSauce() {

            var el = $(document.body).getElements("div")[0];

            alert(el.get('id') + "\n" + el.get("text"));

            }

</script>

<input type="button" onclick="getSauce()" value="get sauce" />

 

Looking at the code the element.clone() function is handled a little
different for IE. It uses the clearAttributes() method on the element object
but according to the MSDN
(http://msdn.microsoft.com/en-us/library/ms536350%28VS.85%29.aspx) docs it
says:-

 

"The clearAttributes method clears only persistent HTML attributes. The ID
attribute, styles, and script-only properties are not affected."

 

It also uses a method element.mergAttributes() which is meant to copy the
attributes from one element to another. The MSDN docs
(http://msdn.microsoft.com/en-us/library/ms536614%28VS.85%29.aspx) say you
pass in a source object and an optional "preserve" flag (true or false) to
say if you want to preserve the identity of the attributes but i don't see
that being used in the mootools code.  

 

I think certainly something that needs to be looked at

 

Steve

 

From: Phil Freo [mailto:[email protected]] 
Sent: Tuesday, 26 October 2010 5:14 AM
To: [email protected]
Cc: Andrew Sutherland
Subject: [Moo] New IE bug in Mootools 1.3 (wasn't there in 1.2)

 

Hello, 

 

I've found a pretty bad bug in Mootools 1.3 that didn't exist in 1.2, that
affects IE6-7 users.

 

I've mentioned this on IRC and not everybody is able to reproduce it, but I
have had several people be able to reproduce it on different computers
running IE6-7, and it has been the root cause of a lot of user complaints
recently on Quizlet.com.

 

The follow pages "work" if you get an alert('sauce') popup.  They don't work
if you get a JS error.  (NOTE: Only IE6-7 are affected).

 

Simplified snippet of the bug:

On 1.2 (this work's fine, alert() msg) -> http://quizlet.com/moo2.htm

On 1.3 (this is broken in IE6-7, js error, no alert()) ->
http://quizlet.com/moo3.htm

 

Screenshots from browsershots.org:

On 1.3 (IE6, broken) ->
http://browsershots.org/screenshots/8dac1f27fb13eb66ae567b4cbe86bb1f

On 1.3 (IE7, broken) ->
http://browsershots.org/screenshots/5750950ec55a32673d4595bdabc9ffbf

On 1.2 (IE6, works) ->
http://browsershots.org/screenshots/ca52437ac6722955a23b7d729f994ce7

On 1.2 (IE7, works) ->
http://browsershots.org/screenshots/f9870b41a948a5c6521289e40e047c13

 

There's definitely a problem... (I've reproduced it on several different
real PCs with native IE7 installations, as well as a couple different
virtual machines with IE6).

 

What's the next step here?

 

Thanks,

Phil






=======
Email scanned by PC Tools - No viruses or spyware found.
(Email Guard: 7.0.0.21, Virus/Spyware Database: 6.16150)
http://www.pctools.com <http://www.pctools.com/?cclick=EmailFooterClean_51> 
======= 





=======
Email scanned by PC Tools - No viruses or spyware found.
(Email Guard: 7.0.0.21, Virus/Spyware Database: 6.16150)
http://www.pctools.com/
=======

Reply via email to