X
Appuyez ici pour vous rendre sur la version mobile du site.

Forum d’assistance

button event

Publié

my button event contains a name that I can access in ie/edge using e.srcElement.actionName and in chrome using e.path[0] .actionName but I am unable to find where it is in the event object returned in Firefox

my button event contains a name that I can access in ie/edge using e.srcElement.actionName and in chrome using e.path[0] .actionName but I am unable to find where it is in the event object returned in Firefox

Modifié le par Pedaars

Citation

Détails additionnels sur le système

Plugins installés

none

Application

  • Agent utilisateur : Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0

Plus d’informations

jscher2000
  • Top 10 Contributor
8635 solutions 70628 réponses

Hi Pedaars, I am not familiar with [node].actionName. What does that return, exactly?

For example, is it the value of the name attribute in the button:

<button name="buy" onclick="doStuff(this)">

or is it referring to the action that triggered the event, like "click"?

Hi Pedaars, I am not familiar with [node].actionName. What does that return, exactly? For example, is it the value of the name attribute in the button: &lt;button name="buy" onclick="doStuff(this)"> or is it referring to the action that triggered the event, like "click"?
Est-ce que ceci vous a été utile ?
Citation

Auteur de la question

it is a custom property in a stencilJS button component

it is a custom property in a stencilJS button component
Est-ce que ceci vous a été utile ?
Citation
jscher2000
  • Top 10 Contributor
8635 solutions 70628 réponses

A custom property of an HTML node? Is it an attribute of the tag?

Regarding event.path there is a pattern to extend that to browsers which use the standardized method composedPath in the following reply. Maybe it will help?

https://stackoverflow.com/a/39245638

A custom property of an HTML node? Is it an attribute of the tag? Regarding event.path there is a pattern to extend that to browsers which use the standardized method composedPath in the following reply. Maybe it will help? https://stackoverflow.com/a/39245638
Est-ce que ceci vous a été utile ?
Citation

Auteur de la question

yes it is an attribute of the tag

yes it is an attribute of the tag
Est-ce que ceci vous a été utile ?
Citation
jscher2000
  • Top 10 Contributor
8635 solutions 70628 réponses

Pedaars said

yes it is an attribute of the tag

So could you change from

event.srcElement.actionName

to

event.target.getAttribute('actionName')

(You only need srcElement if you are supporting IE8 and earlier)

''Pedaars [[#answer-1246273|said]]'' <blockquote> yes it is an attribute of the tag </blockquote> So could you change from event.srcElement.actionName to event.target.getAttribute('actionName') (You only need srcElement if you are supporting IE8 and earlier)
Est-ce que ceci vous a été utile ?
Citation
Poser une question

Vous devez vous identifier avec votre compte pour répondre aux messages. Veuillez poser une nouvelle question, si vous n’avez pas encore de compte.