Running jQuery in Jint by providing an HTMLDocument

Jan 8, 2010 at 6:05 PM

Since Jint can already parse jQuery, I want to push it an actually run jQuery by providing a DOM in the form of HTMLDocument.

I'm running Jint inside of an Internet Explorer Browser Extension (BHO), and so I have access to the HTMLDocument object that represents the page currently being shown to the user. If I pass in the HTMLDocument, and Jint knows how to map js method calls to the HTMLDocument object, then jQuery can run, and any jQuery based code would have effect within the document the user sees.

This allows javascript code to be executed in a sandbox, similar to the evalInSandbox() method in Firefox, and the javascript environment in Chrome. This could be huge.

Is anyone else interested in this? What would be required to make this happen?


(I've talked to sebastienrosabout this via email, but I'm posting it here to see if others are interested)

Feb 23, 2010 at 7:59 PM

Absolutely! I'm trying to wrap my head around Jint, but this is exactly the use case I was after. In my case, I want to get the "final" html after javascript was executed: run http request, then execute javascript in HtmlAgilityPack.HtmlDocument using Jint...

Feb 26, 2010 at 8:59 PM

Have you made any progress on this?  I was wondering if it was possible to take an HTML file with JQuery in it and pass it through some sort of server-side JavaScript interpreter (in C#, preferably) to create modified DOM.

I am currently using HtmlAgilityPack to transform poorly structured HTML files, but I wonder whether it is possible to do DOM parsing and transformation using javascript instead, much as a web browser would do it.




Feb 27, 2010 at 8:32 AM

We have worked a lot on this scenario the past months. We are functional prototypes, and have created a new codeplex project for this purpose. Nicolas (neonp) will be able to tell more as he's the main commiter of this part.

Mar 1, 2010 at 5:04 PM

Sounds cool.  What's the name of the project?  And are there any examples available yet?


Mar 2, 2010 at 7:36 PM

I'm also interested in this?

Jan 20, 2011 at 6:21 PM
Edited Jan 20, 2011 at 6:25 PM

are you talking about this project: HTMLx - JavaScript on the Server for .NET

Jan 20, 2011 at 7:18 PM

Yes. But it has not been updated with the latest jint realease. So I don't know if it still works with the latest realease.

Jan 20, 2011 at 8:30 PM

no it does not. is it possible that you update it? i am also missing jint.env

Jan 21, 2011 at 6:49 AM

I have updated it, but I now have some issues with System classes that cannot be found.