Re: [Saxon-JS 2] Types of events Saxon-JS cannot handle?

Debbie Lockett <debbie-JkSD5nQpfvpWk0Htik3J/[email protected]> Wed, 9 Sep 2020 13:34:35 +0100
Newsgroups gmane.text.xml.saxon.help
Message-ID <[email protected]>
On 09/09/2020 13:09, Martin Honnen wrote:
> Am 09.09.2020 um 13:34 schrieb Martin Honnen:
>> Am 09.09.2020 um 11:42 schrieb Martynas Jusevičius:
>>
>>> 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'.
>>
>> The Chrome console suggests that Saxon has registered an event listener
>> for the "blur" event, it seems on the "document" object, it might be
>> that it needs to be set on the "window" object instead.
>>
>> So perhaps line 25182 in SaxonJS2.rt.js reading
>>
>>                  -1 === "httpabort afterprint beforeprint beforeunload
>> hashchange languagechange message offline online pagehide pageshow
>> popstate storage unhandledrejection unload".split(" ").indexOf(c) ?
>> window.document.addEventListener(c, d, !1) : window.addEventListener(c,
>> d, !1)
>>
>>
>> needs to add "blur" and "focus" in there e.g.
>>
>>                  -1 === "httpabort afterprint beforeprint beforeunload
>> blur focus hashchange languagechange message offline online pagehide
>> pageshow popstate storage unhandledrejection unload".split("
>> ").indexOf(c) ? window.document.addEventListener(c, d, !1) :
>> window.addEventListener(c, d, !1)
>>
>> Wild guess from my side, however.
>
>
> document.addEventListener('blur', ...) doesn't fire in
> https://jsfiddle.net/g3zhs8jp/ while window.addEventListener('blur',
> ...) in https://jsfiddle.net/g3zhs8jp/1/ fires.
>
> So it might indeed be a question as to where Saxon JS sets up the event
> listener for blur.
>
>

As you've discovered, yes, there are some limitations on the events 
Saxon-JS can handle. And you're right - I'm afraid this is currently 
undocumented. The code Martin has directed you to shows the current list 
of events we handle - currently we're only registering events either on 
the window itself, or on the window.document. This is supposed to be a 
"complete" list, but it looks like we need to review it. I've added a 
Saxon-JS bug to investigate further: please see 
https://saxonica.plan.io/issues/4728

(Please also note I was away on holiday last week, and it seems I missed 
lots of Saxon-JS discussion! I'm trying to steadily work through the 
Saxon-JS issues recently raised here, and will be raising more Saxon-JS 
bug/feature issues on plan.io to follow up further. In general that will 
be a better place for logging and tracking issues. But it is great to 
see the community discussions building here. Thanks in particular Martin 
for your quick, and insightful, responses.)

Debbie

-- 
Debbie Lockett
Saxonica



_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[email protected]
https://lists.sourceforge.net/lists/listinfo/saxon-help