1. var metas = document.getElementsByTagName('meta') is supposed to return an array containin the lines that has the meta tag.document.getElementsByTagName is supposed to return a NodeList, not a plain array of Nodes.
That defines a global getElementsByTagName function. You want set it as a property of the document object instead. That way, you should get the document object as the first argument when called.function_get("getElementsByTagName", sub { #use HTML::TagParser, my @array = $p->getElementsByTagName('@_); #$p must point to # the html file containin the page from which meta tags are # to be taken return @array; });
update: in fact, function_get() does not exist in JavaScript::SpiderMonkey. There is a function_set, but that's a method. Have you actually read the documentation?
So to write a perl function similar to the one that i wrote for getElementsByTagName as shown above, i need to get a handle for this metas array object in perl.. How do i get this is my question..Again, metas is not an array. Also, metas[i].getAttribute refers to the getAttribute property of whatever is element i in metas, so you'd better make sure that that property exists. As far as I can tell, your code does nothing of the kind.
In reply to Re^3: How to glue JavaScript and DOM
by Joost
in thread How to glue JavaScript and DOM
by monkster
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |