Can I access the function body of an event listener using nodeJS jsdom

Posted by Zhami on Stack Overflow See other posts from Stack Overflow or by Zhami
Published on 2011-06-24T15:01:06Z Indexed on 2011/06/24 16:23 UTC
Read the original article Hit count: 226

Filed under:
|

I am using jsdom with nodeJS. I load in a large HTML document, and am using jQuery to navigate the DOM. I have a case where I have an element, and I need to access the function body of an event listener (onclick). The event listener was added in the source HTML:

<a href="#" onclick="javascript:window.open('http://<rest-of-url>'); return false;"></a>

The onclick attribute of the DOM element is undefined.

btw: what I really want to do is get the URL (please note that <rest-of-url> is not what is in the source, a real URL spec is there) that is specified in the source.

© Stack Overflow or respective owner

Related posts about dom

Related posts about jsdom