I really like the throw error solution, that is great, I want to
modify this function because I face even a getElementById bug in the
firefox2.0,look at the code:
<script src="prototype.js"></script>
<input type="text" value="this should be returned" name="test"
id="www" />
<input type="text" value="this should not be returned ff2.0 bug not
appeared in ff3.0 a5"

name="test" id="www" />
<script>
alert($("www").value)
window.setTimeout(function(){alert($("www").value)},1000)
</script>

The code "alert($("www").value)" in the loading procession has changed
the ff2.0's getElementById's behaveor, and with ff3.0 alpha5 this bug
won't appeared, so maybe when you face the getELementById's
misbehaving the best solution is to use $$(*[id="..."]), or just throw
a error message and change your html code. For my code:
        if(!element.id || element.id!=id)
        {
                var tmp=[];var y=100;
                var t=document.getElementById(id);
                while(t!=null && t.id!=id)
                {
                        var e=t.outerHTML;
                        y++;
                        t.outerHTML="<hr id='"+y+"'>";
                        tmp.push([document.getElementById(y),e]);
                        t=document.getElementById(id);
                }
                element=t;
                tmp.each(function(node){
                node[0].outerHTML=node[1];
                });
        }
I have some questions,
1.In ie the only way to change a input element's attribute "name" is
to change outerHTML?
2.when I change the one reference element's outerHTML, that reference
becomes invalid, I need to get it again, that is why I add var y and y+
+.
3.Is there a regular expression to get out the name attribute from
these two strings '<input type=button value="aaa lll" name=lll />'
and'<input type=button value="aaa lll" name="lll l" />' one name with
"" one without, and the method to modify it. Thanks
For the performacnce I think if you just use getELementById and change
the bug input's name it would be the fastest, even fast than $$
(*[id='....']).

On Jun 18, 4:31 am, "Adam McCrea" <[EMAIL PROTECTED]> wrote:
> Oh, if only we all had the luxury to "change our sources". ;-)
>
> On 6/17/07, Mislav Marohnić <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > On 6/17/07, Andrew Dupont <[EMAIL PROTECTED]> wrote:
>
> > > return $(document.body).down('*[id=foo]');
>
> > Nice. But there is an alternative that Tobie suggested: not fixing the
> > issue.
>
> >   if (!element.id || element.id != id) throw "Some helpful error message"
>
> > The error would help people learn about this issue and change their
> > sources to avoid it.- Hide quoted text -
>
> - Show quoted text -


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to