This appears to be an issue with IE's shoddy implementation of
getAttribute. (http://tobielangel.com/2007/1/11/attribute-nightmare-in-
ie)

If you do...

$$('a.appLink')[0].getAttribute('href');

... you'll get the resolved URL ("file://foo/bar/whatever/dd.html" if
you're running on a drive) instead of the literal value of the href
attribute ("dd.html"). Prototype's own Element#readAttribute attempts
to fix this (and is used internally by $$), but it appears to fail
after a call to Element#update.

I'll file a bug on this and make Tobie do all the work. I doubt a fix
for this will get into 1.5.1, but I'm sure we can address it for
1.5.2.  Meanwhile, you can use the "$=" operator as a workaround.

Cheers,
Andrew


On Mar 26, 11:53 am, "djthomp" <[EMAIL PROTECTED]> wrote:
> I've been playing around with the release candidate, in particular
> with the new features that $$ has, and I've noticed some
> inconsistencies with how it behaves in IE 6 after an Element.update.
> Basically, it seems like some of the attribute selectors (= and ^=)
> aren't selecting tags that are in a div that has been updated.
>
> Heres a SSCCE:
>
> dd.html:
> <html>
>     <head>
>         <meta http-equiv="Content-Type" content="text/html;
> charset=UTF-8" />
>         <script type="text/javascript" src="http://prototypejs.org/
> assets/2007/3/12/prototype.js"></script>
>         <title>$$ Update Test</title>
>     </head>
>     <body>
>         <div id="content">
>             <a class="appLink" href="dd.html">$$ Test</a>
>         </div>
>
>         <script type="text/javascript">
>             function rewrite() {
>
>                 // don't work
>                 //var css = 'div a[href="dd.html"]';
>                 //var css = 'div a[href^="dd"]';
>
>                 // work
>                 var css = 'div a[href]';
>                 //var css = 'div a[href!="ff.html"]';
>                 //var css = 'div a[href$="html"]';
>                 //var css = 'div a[href*="."]';
>                 //var css = 'div a.appLink';
>
>                 $$(css).each(function(a) {
>                     a.setStyle({color: 'pink'});
>
>                     a.onclick = function() {
>                         $('content').update('<a class="appLink"
> href="dd.html">$$ Test</a>');
>                         rewrite();
>
>                         return false;
>                     };
>                 });
>             }
>
>             rewrite();
>         </script>
>     </body>
> </html>


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to