edbrowse-dev - development list for edbrowse
 help / color / mirror / Atom feed
* [Edbrowse-dev] hyphenated event type names
@ 2017-10-08  5:16 Kevin Carhart
  0 siblings, 0 replies; only message in thread
From: Kevin Carhart @ 2017-10-08  5:16 UTC (permalink / raw)
  To: edbrowse-dev



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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-10-11 17:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-08  5:16 [Edbrowse-dev] hyphenated event type names 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).