溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶(hù)服務(wù)條款》

java中能冒泡的事件有哪些

發(fā)布時(shí)間:2022-01-15 14:18:10 來(lái)源:億速云 閱讀:259 作者:小新 欄目:編程語(yǔ)言

這篇文章主要介紹java中能冒泡的事件有哪些,文中介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們一定要看完!

每個(gè) event 都有一個(gè)event.bubbles屬性,可以知道它可否冒泡。(ref:W3定義的Event Interface)

當(dāng)然 W3 DOM Level 3 Events 的細(xì)則里已經(jīng)附上這個(gè)表格了:

Event TypeBubbling phase
abort?
beforeinput?
blur?
click?
compositionstart?
compositionupdate?
compositionend?
dblclick?
error?
focus?
focusin?
focusout?
input?
keydown?
keyup?
load?
mousedown?
mouseenter?
mouseleave?
mousemove?
mouseout?
mouseover?
mouseup?
resize?
scroll?
select?
unload?
wheel?

還附上了 Legacy Events(舊瀏覽器支持的非標(biāo)準(zhǔn)遺留事件)的 bubble 屬性。

Event TypeBubbling phase
DOMActivate?
DOMAttrModified?
DOMCharacterDataModified?
DOMFocusIn?
DOMFocusOut?
DOMNodeInserted?
DOMNodeInsertedIntoDocument?
DOMNodeRemoved?
DOMNodeRemovedFromDocument?
DOMSubtreeModified?
keypress?

H5 還定義了一些新事件:

  • media相關(guān)事件,都不冒泡

  • drag相關(guān)事件 dragstart 、 drag 、 dragenter 、 dragexit 、 dragleave 、 dragover 、 drop 、 dragend均冒泡

  • History相關(guān)事件:popstatehashchange冒泡(從window開(kāi)始……所以意義在哪里),pagetransition不冒泡

還有很多H5新事件,大多在草案階段,就不一一翻開(kāi)了。

此外,這里還有一個(gè)關(guān)于IE的事件列表,http://www.feiesoft.com/html/events.html

事件冒泡是我們實(shí)現(xiàn)事件代理(委托)的關(guān)鍵,在avalon1.6中,默認(rèn)讓能冒泡的事件都使用事件代理實(shí)現(xiàn)了!

var canBubbleUp = {
    click: true,
    dblclick: true,
    keydown: true,
    keypress: true,
    keyup: true,
    mousedown: true,
    mousemove: true,
    mouseup: true,
    mouseover: true,
    mouseout: true,
    wheel: true,
    mousewheel: true,
    input: true,
    change: true,
    beforeinput: true,
    compositionstart: true,
    compositionupdate: true,
    compositionend: true,
    select: true,
    cut: true,
    paste:true,
    focusin: true,
    focusout: true,
    DOMFocusIn: true,
    DOMFocusOut: true,
    DOMActivate: true,
    dragend:true,
    datasetchanged:true
}
if (!W3C) {
    delete canBubbleUp.change
    delete canBubbleUp.select
}
//....

以上是“java中能冒泡的事件有哪些”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對(duì)大家有幫助,更多相關(guān)知識(shí),歡迎關(guān)注億速云行業(yè)資訊頻道!

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀(guān)點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI