Cannot call method 'toLowerCase' of undefined

Apr 17, 2011 at 7:33 PM

Hello everyone.

Javascript.NET is a fantastic product for its speed and reliability. 

I need to use it for some server side data validation where the javascript engine implementation relies on jQuery. 

When I try to run either jquery-1.4.2.min.js or jquery-1.4.4.min.js in the Noesis.Javascript.JavascriptContext, an exception is raised with the following error

"Additional information: TypeError: Cannot call method 'toLowerCase' of undefined(undefined, line 32)"

To reproduce, run the following javascript in the context (to setup the browser environment)

var navigator = {}; var window = {}; var document = {};

And run the contents of jquery-1.4.2.min.js

After doing some initial research, it looks like this was a bug discovered in Chrome some time ago.

Does anyone know of a workaround for this issue?

Thank you in advance!

Rob

Apr 29, 2011 at 10:38 AM

Did you check the V8 version? It sounds like this library uses an old version of it..

Do you mind posting the link to the chrome bugtracker? Might make it easier for us to check if we should update to a newer version of V8!

Begin able to run jQuery seems to be rather important imho!

Coordinator
Apr 29, 2011 at 5:15 PM

While we are unable to prioritize a V8 update in the Javascript.NET library at this time, the community is more than welcome to take part in this update.

Code update submissions made to the source code can be submitted to us for a quick validation. We will be able to publish these type of changes for the benefit of the community. It is important if you wish to proceed with an update to maintain the file structure in the actual source code package to ease validation and integration on our end.

Thanks to all contributors and users for their interest in this library.

Noesis

Developer
May 2, 2011 at 12:06 AM

If someone does update v8, please consider using my 64-bit project file rather than Noesis' .vcproj as your base of work, because it is already configured to build to both 32- and 64-bit targets.

May 3, 2011 at 2:59 PM

Thank you all for your comments. 

I have looked into the issue more and I don't believe the solutions should be implemented in V8 itself. 

jQuery expects to use an underlying DOM which should be considered an extension of V8 and not part of the script engine itself.

Our solution was to separate the UI from the core logic components thereby eliminating the need for jQuery on the server. 

This makes for a more elegant and minimalistic solution. 

That said, having a project like Javascript.NET DOM (perhaps based on WebKit) could be very useful to someone. 

Rob