From: Kevin Carhart <kevin@carhart.net>
To: Edbrowse-dev@lists.the-brannons.com
Subject: Re: [Edbrowse-dev] nasa / prepending "on" to events
Date: Fri, 26 Jan 2018 02:38:15 -0800 (PST) [thread overview]
Message-ID: <alpine.LRH.2.03.1801260206350.27769@carhart.net> (raw)
In-Reply-To: <20180026040830.eklhad@comcast.net>
Hi Karl
>
> So all of this doesn't answer my question.
I think you only have to run onclick, because the "click" system is
running all the time. As long as we provide a DOM, and the
ID and name and class attributes are all standard, the code is establishing, removing,
and calling all the time. And also due to the presence of side effects
like instant innerHTML. That Drescher site is an example. One of the
links triggers ajax, and this is not tied either to a hyperlink or inline
"on" handler. There's another source. The hyperlink has standard IDs,
so our DOM methods rope it in to a set that is queried for with the
GetElements functions. Then, because that certain <A> was in the result
set, it gets a click handler doled out to it which then works for the
user. So we're doing both already - I think.
>> I think isn't it also true that all of the attributes beginning with "on" are
>> one-of-a-kind entities?
>
> Do you mean there is just one of them? I don't think so.
> I think some websites start with onclick= in html, for a handler, then add another one via javascript and they are both suppose to run, at least I sort of remember that but can't point to a specific site right now.
> So my code supports this.
> If there is already a function onclick, that becomes onclick array[0], and the next one pushes and so on.
> That's what I do, and it may not be right, but I don't think it's wrong.
Sorry, I sort of mixed two connotations here. In that particular thing
about the one-of-a-kind entities, I was only trying to refer to the fact
that you have hand-tailored work such as the function set_onhandlers() in
decorate, which does a lot for a small number of useful inline handlers.
So this might coexist comfortably with a different system that is suited
for dynamic naming that does not need to have been delineated at compile
time.
But the other thing you raised from this was:
> Do you mean there is just one of them? I don't think so.
I think we have it from the horse's mouth from a mozilla page.
https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Event_handlers
The Web platform provides several ways to get notified of DOM events. Two
common styles are: the generalized addEventListener() and a set of
specific on-event handlers. This page focuses on the details of how the
latter work. ... The on-event handlers are a group of properties offered
by DOM elements to help manage how that element reacts to events. Elements
can be interactive (e.g. links, buttons, images, forms) or non-interactive
(e.g. the base document). Events are the actions like being clicked,
detecting pressed keys, getting focus, etc. The on-event handler is
usually named according to the event it is designed to react to, such as
onclick, onkeypress, onfocus, etc.... Note that each object can have only
one on-event handler for a given event (though that handler could call
multiple sub-handlers). This is why addEventListener() is often the
better way to get notified of events, especially when wishing to apply
various event handlers independently from each other, even for the same
event and/or to the same element.
next prev parent reply other threads:[~2018-01-26 10:38 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-19 20:08 [Edbrowse-dev] Error Object Karl Dahlke
2018-01-19 20:51 ` Dominique Martinet
2018-01-25 10:48 ` [Edbrowse-dev] defaultView / cloning onevent$$array Kevin Carhart
2018-01-25 14:07 ` Karl Dahlke
2018-01-25 23:07 ` Kevin Carhart
2018-01-26 2:58 ` Karl Dahlke
2018-01-26 3:50 ` [Edbrowse-dev] nasa / prepending "on" to events Kevin Carhart
2018-01-26 4:59 ` Karl Dahlke
2018-01-26 5:51 ` Kevin Carhart
2018-01-26 6:43 ` Karl Dahlke
2018-01-26 8:10 ` Kevin Carhart
2018-01-26 8:21 ` Kevin Carhart
2018-01-26 9:08 ` Karl Dahlke
2018-01-26 10:38 ` Kevin Carhart [this message]
2018-01-26 14:32 ` Karl Dahlke
2018-01-26 19:13 ` Geoff McLane
2018-01-26 19:28 ` Karl Dahlke
2018-01-27 3:52 ` Kevin Carhart
2018-01-27 18:52 ` Geoff McLane
2018-01-27 21:10 ` Karl Dahlke
2018-01-28 3:12 ` Karl Dahlke
2018-01-28 19:19 ` Geoff McLane
2018-01-28 21:35 ` Karl Dahlke
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.1801260206350.27769@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).