edbrowse-dev - development list for edbrowse
 help / color / mirror / Atom feed
From: Kevin Carhart <kevin@carhart.net>
To: Edbrowse-dev@lists.the-brannons.com
Subject: [Edbrowse-dev]  jQuery
Date: Wed, 7 May 2014 15:27:40 -0700 (PDT)	[thread overview]
Message-ID: <alpine.LRH.2.03.1405071321250.15579@carhart.net> (raw)




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

             reply	other threads:[~2014-05-07 22:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-07 22:27 Kevin Carhart [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-05-07 22:54 Karl Dahlke
2014-05-09  0:57 ` Kevin Carhart
2014-05-07 19:52 Karl Dahlke
2014-05-08 16:31 ` Adam Thompson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LRH.2.03.1405071321250.15579@carhart.net \
    --to=kevin@carhart.net \
    --cc=Edbrowse-dev@lists.the-brannons.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).