I'm working on a framework that builds off of the latest snapshot
prototype.js for use where I work. It contains parts that:
- Repeat a set of html code and inserts it as the innerHTML of an
element
- Adds a method to each element that will return child elements by id
I've found that in ie, after I alter the innerHTML, if I then use my
child by id routine to grab an element, and send it through $() to
have it "extended" the child element comes out the other end without
being extended.
It turns out that in some situations the _extended attribute ends up
on these children without it ever being placed there. Maybe because
after the repeating of the HTML, elements temporarily have the same id.
I found that if _extended is a function and not just a 'true' flag
then ie won't mysteriously place it on unextended elements.
For legacy reasons, I map $() to el() in my library. I've wrapped $
() with a fix that could easily be placed within $() itself.
// Same as $, but fixes ie bugs,
var el_extended = function() { return true; }
var el = function() {
var results = [], element;
for (var i = 0; i < arguments.length; i++) {
var elem = $(arguments[i]);
elem._extended = el_extended;
results.push(elem);
}
return results.length < 2 ? results[0] : results;
};
Hopefully this is useful to others and not redundant. I can provide
more details and work out a patch to prototype.js if needed. I've
not really dealt with subversion, etc, before, so it might be easier
if someone else could take this up.
I'd love to share more of what I'm doing re my framework, but I need
to get some better clearance from those who can clear up all the
licensing specifics. I think that will happen, its just something
new to us. Prototype has been a great base to build from.
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs