Skip Menu |

This queue is for tickets about the WWW-Scripter-Plugin-JavaScript CPAN distribution.

Report information
The Basics
Id: 66747
Status: resolved
Priority: 0/
Queue: WWW-Scripter-Plugin-JavaScript

People
Owner: Nobody in particular
Requestors: martin [...] akm.com.au
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.006
Fixed in: (no value)



Subject: Problem with JS includes within the HTML doc
Hi, I think i have found a problem with the WWW::Scripter::Plugin::JavaScript module. I have tried this with JE and SpiderMonkey and get the same results from both, which is why i think it a problem with this module. The problem is that I have a page with a JavaScript include in it: <script type="text/javascript" src="/js/jquery-latest.js"></script> So when i execute a GET on this page it first gets the HTML page then proceeds to GET all the included JavaScript files defined in the document, which is great. But the JavaScript document object is always null, in the included files. I guess because it is a JS file, which does not have a document. But in this case it should have a document because it is included from the HTML document. The following is the error that i get: TypeError: null has no properties, not even one named defaultView at http://..../js/jquery-latest.js, line 12. Which is a line of JS (within JQuery) that says: defaultView = document.defaultView || {} And then since the JQuery library has errors, my page doesn't work properly. So I was wondering if it was possible for JavaScript includes within the HTML document to be associated with the document object from the HTML page that it is included from. Another way of getting around it that I thought of was to read in the JavaScript file, and then insert the file contents into the HTML where the JavaScript include was. This way all the pages HTML and JavaScript would be in the $mech->contents and then when theJavaScript evaluator run over the page, all the JS would be associated with the document. But I wasn't sure how to implement that. Any help with is problem would be greatly appreciated. Thanks Martin
From: martin [...] akm.com.au
Hi, Sorry this has turned out to be a problem with our testing class. The object is not cloning properly for some reason, probably due to the crazy inheritance. You can just ignore the previous post. Thanks, Martin