For whomever might be interested:
i had some special needs for an Autocomplete object, and having to
filter out the "informal" content from the LI elements was too tricky,
and caused much invalid HTML. So i added the following to effects.js:
---
Element.collectTextNodesRequireClass = function(element, className){
return $A($(element).childNodes).
// Filter childNodes for elements with class ''formal'':
findAll(function(node){return (node.nodeType==1 &&
Element.hasClassName(node,className));}).
// Collect all text nodes from remaining elements:
collect(function(node){return Element.collectTextNodes(node);}).
flatten().join('''');
};
---
In controls.js, Autocompleter.Base.updateElement, replaced the line
(248-ish) that reads:
"value = Element.collectTextNodesIgnoreClass(selectedElement,
''informal'');"
with:
"value = Element.collectTextNodesRequireClass(selectedElement,
''formal'');"
To accomodate, i removed all the <span class="informal> content from
my result HTML and at the end of each <LI> i''ve inserted the
content i
WANT to appear in the target element into:
<span class="formal">Content For The Text Box</span>
and made a CSS rule:
span.formal{display:none}
to hide the spans within the <UL>.
Obviously, it''s a hacked-up approach, but it''s simplified
things for
me. i don''t have to inject a lot of extra SPAN.informal tags to omit
unwanted content, and at a glance i know in my output code exactly
what will end up in the text box. There''s no API access to make a
choice between the two approaches, but perhaps someone with more
experience with the inner workings (and more time) could make it so
that the IgnoreClass/RequireClass paths are optional.
--
joe t.
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---