What am I looking at here?
Kevin Ballard
kevin at sb.org
Tue Sep 6 20:20:29 EDT 2005
On Sep 6, 2005, at 6:39 PM, Ben Giddings wrote:
> * Does it have to be named foo.user.rb to be recognized when I put
> it in
> the userScripts directory?
Yes.
> * What if I want it to match every URL, is there a good way to do
> that?
include_match %r{} should work.
> * What is "document"? The wiki docs say it's an HTree, but when I
> click on
> that link I see nothing named "elements". Primitive debugging
> seems to
> suggest it's a REXML::Document...?
I believe HTree is some sort of wrapper around REXML::Document, or at
the very least forwards its messages on to that.
> * XPath seems to say that '//div[@class="ch"]' should give me all
> the div
> nodes with a class "ch", but document.elements[XPATH] seems to only
> give
> me one, so I have to loop
document.elements[XPATH] fetches a single element. You want
document.get_elements[XPATH] to fetch all, or (and this should be a
little faster) document.each_element(XPATH) { |e| } or
document.elements.each(XPATH) { |e| }.
--
Kevin Ballard
kevin at sb.org
http://www.tildesoft.com
http://kevin.sb.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2378 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/mousehole-scripters/attachments/20050906/b85bfc26/smime.bin
More information about the Mousehole-scripters
mailing list