Closed marnen closed 14 years ago
OK. I figured out that since current_context is a Nokogiri::XML::Node, I can do current_context.search('.hiMom').each do |node| text node, 'hi mom' end Perhaps this should be better documented?
current_context is an internal method, so you shouldn't have to use it in your views. I designed Effigy to fail loudly if find didn't get any nodes, but that doesn't make a lot of sense when you're trying to select multiple nodes, and it's out of line with what jQuery does. Maybe the scopes should work more like jQuery and transform multiple nodes by default?
Yes, jQuery-style transformation might be nice.
Or...if current_context shouldn't be used, how would you suggest doing what I described?
Perform transformation operations on all selected nodes. Selections that find no nodes now silently do nothing. (closed by b1203318dbdef036282be5a0796dc9b2b5c1465d)
Sorry to be confusing. What you were doing is correct. I just meant that Effigy shouldn't force you to do current_context as long as you're doing something reasonable. The next version of Effigy will apply transformations to all selected nodes, so you won't need to do this anymore.
At the moment, it looks like find only finds the first node that matches the selector. It would be really convenient to be able to do Here's one And here's another