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] hyphenated event type names
Date: Sat, 7 Oct 2017 22:16:55 -0700 (PDT)	[thread overview]
Message-ID: <alpine.LRH.2.03.1710072205340.7496@carhart.net> (raw)



I think I may have hit on a good one.  It began because some page code 
wants to address an event handler on an event called 'invalid-form'.

I think this currently doesn't work because the eval() that we have in our 
our add event handler code uses the 'dot' style for property referencing. 
The evaluation of a string like blah.invalid-form raises an error.

But I think we can get these to work by changing it to bracket style, like 
this:
eval(
'this[\'' + ev + '\'] = function(){ var a = this[\'' + evarray + '\']; 
if(this[\'' + evorig + '\']) this[\'' + evorig + '\'](); for(var i = 0; 
i<a.length; ++i) {var tempEvent = new Event;tempEvent.type = "' + 
ev_before_changes + '";a[i](tempEvent);} };');

It becomes ugly because I added escaped single quotes, but it works!

I wonder if this might come up quite a bit and we never knew.  Also, I am 
excited, because this *might* fit the profile for being the answer to a 
major headache, which is error messages without a line number.  There are 
quite a few of these at the very end of the logging for a particular run.
I have not known what they are or how to address them in order to fix 
them.  These are the ones that remain opaque, even with the wonderful, 
lovely new diagnostic tools.

What if every single time some page's javascript was trying to 
build event types programmatically in a string variable, and use a hyphen 
between pieces, it wasn't working in edbrowse because of the difference between 
dot referencing and bracket referencing, and what if from now on, it can?

Could be big!


K


                 reply	other threads:[~2017-10-11 17:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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.1710072205340.7496@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).