Project

Profile

Help

Bug #4728

closed

Coverage for event handling

Added by Debbie Lockett about 4 years ago. Updated almost 2 years ago.

Status:
Closed
Priority:
Normal
Category:
Internals
Sprint/Milestone:
-
Start date:
2020-09-09
Due date:
% Done:

100%

Estimated time:
Applies to JS Branch:
2
Fix Committed on JS Branch:
2
Fixed in JS Release:
SEF Generated with:
Platforms:
Company:
-
Contact person:
-
Additional contact persons:
-

Description

As raised on the saxon-help list, we do not document which types of events Saxon-JS can, and cannot, handle. Currently not all events are handled, but the documentation doesn't include anything about the restrictions.

The event handling coverage should be extended, and the documentation improved.

Martynas's original message:

are there any limitations re. the types of events Saxon-JS can handle? I don't think there is anything in the documentation on this topic.

I'm doing a simple 'onblur' test but cannot get it to work (no effect):

    <xsl:template match="input[tokenize(@class, ' ') = 'typeahead']"
mode="ixsl:onblur">
        <xsl:sequence select="ixsl:call(ixsl:window(), 'alert', [
'typeahead blur' ])"/>
    </xsl:template>

Reproducible code: https://github.com/namedgraph/saxon-js2-test/tree/gh-pages

Previously with Saxon-CE I also had to revert to JS with events such as 'onsubmit'.


Related issues

Related to SaxonJS - Feature #4844: Could 'resize' be added to the list of windowEvents?ClosedNorm Tovey-Walsh2020-11-28

Actions
Actions #1

Updated by Debbie Lockett about 4 years ago

This also reminds me that (at XML Prague 2019) Cristian Talau (Oxygen) had related issues with event handling on audio elements. (Similarly his work around was to revert to pure JavaScript for the event listeners). Note that here there are events specific to HTMLMediaElements, not defined on standard HTMLElements; so perhaps the usual bubbling is not working. This still needs further investigation.

Actions #2

Updated by Debbie Lockett about 4 years ago

See also the discussion on xml.com slack today:

Pieter Lamers reported that onscroll doesn't work, e.g.

  <xsl:template match="*" mode="ixsl:onscroll">
    <xsl:message>Scroll event found</xsl:message>
  </xsl:template>

And Erik Siegel says:

I have never been able to receive an ontoggle event for a <details> element...

Actions #3

Updated by Martynas Jusevicius almost 4 years ago

popstate event does not seem to be supported either: https://developer.mozilla.org/en-US/docs/Web/API/Window/popstate_event

Actions #4

Updated by Michael Kay almost 4 years ago

See also bug #4844 regarding the resize() event.

Actions #5

Updated by Debbie Lockett almost 4 years ago

  • Related to Feature #4844: Could 'resize' be added to the list of windowEvents? added
Actions #6

Updated by Pieter Lamers almost 4 years ago

Hi, I'd be curious to learn if a workaround can be suggested for catching the Scroll event or if any progress is being made on adding support for it. in the document Gerrit mentioned on the xml.com slack, it is mentioned that for catching system events, one should match on '.' rather than '*'. Unfortunately this does not catch the scroll event either. I have multiple use cases for capturing scroll events, and for me event listeners are the main raison d'ĂȘtre for SaxonJS.

Actions #7

Updated by Norm Tovey-Walsh almost 4 years ago

  • Assignee changed from Debbie Lockett to Norm Tovey-Walsh

Hi Pieter,

I'm hoping to spend some time this week investigating a couple of event-related issues, including this one. I'll let you know what I find out.

Actions #8

Updated by Norm Tovey-Walsh almost 4 years ago

  • Status changed from New to In Progress

The scroll event seems to be working for me. Note that the match pattern for these events is "." not "*":

<xsl:template mode="ixsl:onscroll" match=".">
  <xsl:call-template name="increment">
    <xsl:with-param name="id" select="'onscroll'"/>
  </xsl:call-template>
</xsl:template>

(In my unit test, the increment template updates a counter on the page. I'll be using this to make some Selenium tests to track regressions on this behavior.)

Actions #9

Updated by Norm Tovey-Walsh almost 4 years ago

I think the story on blur is that it doesn't bubble so Saxon-JS never sees it. Saxon-JS puts the event handlers on the document object. In modern browsers focusout is very similar to blur but does bubble so we can capture that one.

Actions #10

Updated by Norm Tovey-Walsh almost 4 years ago

Erik mentions having trouble with "ontoggle" on a details element, but I can find no indication that there is an ontoggle event in the DOM.

Actions #11

Updated by Norm Tovey-Walsh almost 4 years ago

  • Status changed from In Progress to Resolved

The list of window events has been updated as follows: httpabort, afterprint, beforeprint, beforeunload, hashchange, languagechange, message, offline, online, pagehide, pageshow, popstate, storage, unhandledrejection, unload, resize, focus (that is, resize and focus have been added). The focus event is for the window, not to be confused with focus events for elements on the page.

There's a test case (test4844) for a wide range of events: animationend, animationiteration, animationstart, click.button, click.mouse, contextmenu, copy, cut, drag, dragend, dragenter, dragleave, dragover, dragstart, drop, focus, focusin, focusout, keydown, keypress, keyup, mousedown, mousemove, mouseout, mouseover, mouseup, offline, online, paste, reset, resize, scroll, select, submit, transitionend, transitionrun, transitionstart, wheel all of which have been tested and several of which are automated with Selenium.

As a general rule, I think events that bubble up will work and events that don't bubble up will not.

Actions #12

Updated by Martin Honnen almost 4 years ago

Norm Tovey-Walsh wrote:

Erik mentions having trouble with "ontoggle" on a details element, but I can find no indication that there is an ontoggle event in the DOM.

https://developer.mozilla.org/en-US/docs/Web/API/HTMLDetailsElement/toggle_event defines the toggle event, it doesn't bubble up so it would need to be registered on a details element, not the document object.

Actions #13

Updated by Norm Tovey-Walsh almost 4 years ago

  • Status changed from Resolved to In Progress

Re-opened to make sure we update the docs.

Actions #14

Updated by Community Admin almost 4 years ago

  • Applies to JS Branch 2 added
  • Applies to JS Branch deleted (2.0)
Actions #15

Updated by Debbie Lockett almost 4 years ago

  • Fix Committed on JS Branch 2 added
Actions #16

Updated by Norm Tovey-Walsh over 3 years ago

  • Status changed from In Progress to Resolved

Documentation updated.

Actions #17

Updated by Debbie Lockett over 3 years ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100
  • Fixed in JS Release set to Saxon-JS 2.1

Bug fix applied in the Saxon-JS 2.1 maintenance release.

Actions #18

Updated by Martynas Jusevicius almost 2 years ago

dblclick bubbles but I don't see it on the list?

Actions #19

Updated by Norm Tovey-Walsh almost 2 years ago

New bug #5796

Please register to edit this issue

Also available in: Atom PDF Tracking page