* marc-olivier bernard wrote (11/07/06 15:26):
On 7/11/06, marc-olivier bernard <[EMAIL PROTECTED]> wrote:
I am not sure whether the problem is due to Scriptaculous or to
Firefox's DOM Engine.
It is a firefox bug. I posted a comment on Bugzilla Mozilla:
https://bugzilla.mozilla.org/show_bug.cgi?id=300016#c10
Are you sure it's a Firefox bug? The way the builder code works is very
strange... to create an option element, it seems to create a select
element, put the option element into it, then fetch the option out of
that select element again. The result is that the option is *always*
selected. I think it's because firefox is treating it as the only
element in the select list, which means it must be selected. [When I run
your code, the last element in the list is selected, rather than the
first. If I debug the value of the "selected" attribute, it's "selected"
for all of them]
This code, which is pure DOM and has none of the builder weirdness, but
sets attributes in the same way, works in Firefox:
var dr=document.createElement("select");
var op=document.createElement("option");
op.appendChild(document.createTextNode("any"));
dr.appendChild(op);
op=document.createElement("option");
op.appendChild(document.createTextNode("all"));
op["selected"]="selected"; // <- attribute set here
dr.appendChild(op);
op=document.createElement("option");
op.appendChild(document.createTextNode("none"));
dr.appendChild(op);
$('modification1').appendChild(dr);
Chris
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs