X
點擊此處開啟此網站的行動版。

技術支援討論區

button event

已張貼

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

由 Pedaars 於 修改

引用
jscher2000
  • Top 10 Contributor
8638 個解決方法 70669 個答案

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"?
這篇文章有幫助嗎?
引用

提出問題者

it is a custom property in a stencilJS button component

it is a custom property in a stencilJS button component
這篇文章有幫助嗎?
引用
jscher2000
  • Top 10 Contributor
8638 個解決方法 70669 個答案

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
這篇文章有幫助嗎?
引用

提出問題者

yes it is an attribute of the tag

yes it is an attribute of the tag
這篇文章有幫助嗎?
引用
jscher2000
  • Top 10 Contributor
8638 個解決方法 70669 個答案

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)
這篇文章有幫助嗎?
引用
問個問題

如果您還沒有帳號,您必須先 登入您的帳號 來回覆文章。請 開始一個新問題