edbrowse-dev - development list for edbrowse
 help / color / mirror / Atom feed
* [Edbrowse-dev] jQuery
@ 2014-05-07 19:52 Karl Dahlke
  2014-05-08 16:31 ` Adam Thompson
  0 siblings, 1 reply; 5+ messages in thread
From: Karl Dahlke @ 2014-05-07 19:52 UTC (permalink / raw)
  To: Edbrowse-dev

My first foray into jquery has me shaking my head.

https://learn.jquery.com

I downloaded jquery-1.11.1.js,
and at least it is real code, not minimized.
But what is the point?
It reminds me, decades ago, a proff showed me how you could
use the preprocessor to almost turn C into pascal.

#define begin {
#define end }
etc

And then he said, "but don't ever do that!"

jquery seems to be a huge library of functions that overlay prototypes and
all sorts of things to make js more powerful I guess.
If we have a perfect js dom implementation then jquery would run just fine,
but we don't.

My first load of the library gives this error.

jquery-1.11.1.js: 916: TypeError: document is undefined

Really?
almost the first thing I do in createJavaContext is make the document object.
It's there from the start, but somehow something in this library has caused
it to disappear.
I haven't had the time or the inclination to track down what has happened.

Karl Dahlke

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Edbrowse-dev] jQuery
  2014-05-07 19:52 [Edbrowse-dev] jQuery Karl Dahlke
@ 2014-05-08 16:31 ` Adam Thompson
  0 siblings, 0 replies; 5+ messages in thread
From: Adam Thompson @ 2014-05-08 16:31 UTC (permalink / raw)
  To: Karl Dahlke; +Cc: Edbrowse-dev

[-- Attachment #1: Type: text/plain, Size: 2237 bytes --]

On Wed, May 07, 2014 at 03:52:25PM -0400, Karl Dahlke wrote:
> My first foray into jquery has me shaking my head.
> 
> https://learn.jquery.com
> 
> I downloaded jquery-1.11.1.js,
> and at least it is real code, not minimized.
> But what is the point?

Yeah, I've only recently started looking into this as well and I'm still unsure.

> It reminds me, decades ago, a proff showed me how you could
> use the preprocessor to almost turn C into pascal.
> 
> #define begin {
> #define end }
> etc
> 
> And then he said, "but don't ever do that!"

Yeah... I've never seen that done before and hope I never see it in actual code.

> jquery seems to be a huge library of functions that overlay prototypes and
> all sorts of things to make js more powerful I guess.

I'm not so sure it's about making js more powerful,
from what I've seen so far it just looks like a way to abstract away the
details of web development allowing the use of the latest GUI coding patterns.
To my mind, whereas this certainly makes developing web content easier for all
those java and similar object oriented programmers out there,
it doesn't really increase the power of js.

> If we have a perfect js dom implementation then jquery would run just fine,
> but we don't.
> 
> My first load of the library gives this error.
> 
> jquery-1.11.1.js: 916: TypeError: document is undefined
> 
> Really?
> almost the first thing I do in createJavaContext is make the document object.
> It's there from the start, but somehow something in this library has caused
> it to disappear.
> I haven't had the time or the inclination to track down what has happened.

I've not looked through jquery to see if it does this,
but I seem to remember seeing the below code a bunch of times in js functions on
websites which don't work with edbrowse:
var document = some.set.of.js.calls();

I can't remember what went after the = but I remember wondering why anyone
would want to define the document variable and being somewhat surprised to see
that people actually did this.

I think if we can get child nodes working though that'd certainly help.

Sorry I don't have more time to look into this at the moment.

Cheers,
Adam.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Edbrowse-dev] jQuery
  2014-05-07 22:54 Karl Dahlke
@ 2014-05-09  0:57 ` Kevin Carhart
  0 siblings, 0 replies; 5+ messages in thread
From: Kevin Carhart @ 2014-05-09  0:57 UTC (permalink / raw)
  To: Edbrowse-dev



> You may want to get and use 3.5.1,

Thanks Karl! Ok, I will compile 3.5.1 and report back.  attachEvent and 
parentNode sound like the kind of thing a lot of pages will be looking 
for, so that's exciting.

> and perhaps you will join the development team if you find time.

Thank you - yes, I assume there are some tasks that are comprehension 
heavy, and others that are more rote.  I remember you talking about the 
error legs that needed to get done.  So I would like to do something, if 
possible.

Kevin

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Edbrowse-dev]   jQuery
@ 2014-05-07 22:54 Karl Dahlke
  2014-05-09  0:57 ` Kevin Carhart
  0 siblings, 1 reply; 5+ messages in thread
From: Karl Dahlke @ 2014-05-07 22:54 UTC (permalink / raw)
  To: Edbrowse-dev

> Hello - I am Kevin - I appreciate being able to lurk on the list

Please continue to read and post, it is quite helpful,
and perhaps you will join the development team if you find time.

You may want to get and use 3.5.1,
even though that is not an official version release yet.
A lot of changes there; the required change of supporting mozjs 24, but also
new features.
One is attachEvent(), which you aluded to in your post.
This is plain js, not jquery, but jquery may well use this feature
to atttach events to actions.
So pages that would attach a javascript function to a click or a load
will now do something whereas they did nothing before.

parentNode is also new;
I try to connect each node to its parent when created.
This is relevat to your description of the document tree,
and yes web js uses and expects and even modifies this tree all over the place;
we have to support it!
If I am doing the parentnode properly, it would not be too hard
to add in the reverse logic to build the child node links.
Then write the functions to add new nodes
into the tree dynamically.
This is all moving forward, I think,
in the right direction, but slowly,
as it's just a couple of volunteers with some spare time.
Let me know if you can get, build, and use the latest,
and if you have further thoughts on design and development.

Karl Dahlke

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Edbrowse-dev]  jQuery
@ 2014-05-07 22:27 Kevin Carhart
  0 siblings, 0 replies; 5+ messages in thread
From: Kevin Carhart @ 2014-05-07 22:27 UTC (permalink / raw)
  To: Edbrowse-dev




Hello - I am Kevin - I appreciate being able to lurk on the list for a 
while.  I have been waiting to post til I had something salient to post 
about.  I might finally have something to contribute on this.  I have 
briefly corresponded a bit with Karl and Chris from time to time, as far 
back as 2008.

As the edbrowse docs put it, "many sighted users have taken 
advantage of the unique scripting capabilities of this program, 
which can be found nowhere else," and this is my background with the 
program.  I love it.  edbrowse got me thinking about JS in a different 
way.

As I have used edbrowse on scripting jobs that I do professionally, I have 
set aside mysterious web pages that didn't work in edbrowse.  One is 
yellowpages.com.  Another is alabamaconnect.gov, which I once had to 
script and banged my head on.

I set these sites aside to go and investigate some day and recently I have 
finally put some time into it.  I'm not sure if this is obvious or if you 
have discovered this already, Karl, Chris, Adam, et al, but I think one 
big reason that a page behavior doesn't work in edbrowse that we might be 
able to do something about is event handlers that cannot be picked up by 
handlerPresent and handlerGo.

For some of these handlers, the problem is joined at the hip with jquery. 
We would need to unravel the jquery representation of the handler, and get 
into the plain javascript that the jquery is a wrapper around, in order 
for handlerPresent to find and process that handler.

As you may already know, jquery has a concept called selectors.  They have 
come up with a variety of ways of slicing up and returning a subset of the 
elements from a hierarchical web page.  jquery has feature-itis..it allows 
lazy designer/developers to avoid having to learn the deeper level by just 
calling a toy with a million features.  (But I mostly use interpreted, 
garbage-collected and scripting languages, so I am one to talk... (smile) 
)

So maybe a given web page has a selector that says:
$(select elements whose title contains 'e').onClick ( alert 'something');

I am not yet clear on how this is evaluated and what happens to the 
onClick.  If there are 7 elements that satisfy the selector condition, is 
the onClick doled out to each of the 7?  It must be stored somewhere.. the 
holy grail for me has been how can I tell handlerPresent where to find 
this?   And how can I do it in a generic way that doesn't just 
accomodate the hot library of 2014 but will keep on working when 
something else gets fashionable.

I think getting this to work is wrapped up with getting more DOM into 
edbrowse. 
I have done some hacking on this by bringing in an existing library called 
env.js.

It might potentially be a way to implement a DOM in edbrowse without 
having to implement the spec from scratch.  Or it could introduce a lot of 
trouble of its own and be no good, but on an experimental basis, I have 
played with it to see how far I could get.  If I want to implement 
certain event handlers, I need jquery, and if I need jquery, I need a
DOM.

env.js is intended for use with Rhino, but I have struggled to get it to 
work with Spidermonkey.  I have it partially working.  I think some 
selectors use regular expressions and others make heavy use of the 
standard getElementsByTagName and getElementByID under the hood.  This is 
where I am right now.  It's a bit tricky.  I know you all have implemented 
gEBI and gEBTN by using document.all and document.idMaster -right? - , but 
I have had problems reconciling the window.document that is pumped in 
from jsdom.c, with something that needs to be a Node and have childNodes. 
Because the javascript implementation of document.getElementsByTagName 
that I have been using expects to be passed something with .childNodes 
and be able to traverse a node tree recursively in order to match at 
lower-down levels.

I hope this makes sense- the long and short of it is that if we want to 
implement selectors, we might be able to tell handlerPresent about a lot 
more handlers that are currently concealed, and hopefully this would mean 
a chunk of new pages that would work in edbrowse.

thanks; good to be in contact with you all,
Kevin



---------- Forwarded message ----------
Date: Wed, 7 May 2014 12:52:25
From: Karl Dahlke <eklhad@comcast.net>
To: Edbrowse-dev@lists.the-brannons.com
Subject: [Edbrowse-dev] jQuery

My first foray into jquery has me shaking my head.

https://learn.jquery.com

I downloaded jquery-1.11.1.js,
and at least it is real code, not minimized.
But what is the point?
It reminds me, decades ago, a proff showed me how you could
use the preprocessor to almost turn C into pascal.

#define begin {
#define end }
etc

And then he said, "but don't ever do that!"

jquery seems to be a huge library of functions that overlay prototypes and
all sorts of things to make js more powerful I guess.
If we have a perfect js dom implementation then jquery would run just fine,
but we don't.

My first load of the library gives this error.

jquery-1.11.1.js: 916: TypeError: document is undefined

Really?
almost the first thing I do in createJavaContext is make the document object.
It's there from the start, but somehow something in this library has caused
it to disappear.
I haven't had the time or the inclination to track down what has happened.

Karl Dahlke
_______________________________________________
Edbrowse-dev mailing list
Edbrowse-dev@lists.the-brannons.com
http://lists.the-brannons.com/mailman/listinfo/edbrowse-dev

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-05-09  0:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-07 19:52 [Edbrowse-dev] jQuery Karl Dahlke
2014-05-08 16:31 ` Adam Thompson
2014-05-07 22:27 Kevin Carhart
2014-05-07 22:54 Karl Dahlke
2014-05-09  0:57 ` Kevin Carhart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).