W3C home > Mailing lists > Public > public-html-ig-zh@w3.org > October 2010

Re: 讨论一下讨厌的script标签

From: John Hax <johnhax@gmail.com>
Date: Fri, 22 Oct 2010 19:39:55 +0800
Message-ID: <AANLkTikZc6-j8zizX4BJ+gty54SOrNFPEztvNTY8Tj-6@mail.gmail.com>
To: Zi Bin Cheah <zibin@opera.com>
Cc: (wrong string) 樂會ML <public-html-ig-zh@w3.org>
此问题并不是说DOMContentLoaded事件,见上篇回复。


另,新的DOM3Event规定listener必须按照注册的先后顺序触发。实际上现在的浏览器似乎都是按照顺序触发的。

不过IE的attachEvent不是按顺序的,其顺序非常诡异。

2010/10/22 Zi Bin Cheah <zibin@opera.com>

>
>
>  現在有 DOMContentLoaded 事件
>>
>
> onEventListener的model比DOM0的onEvent好,不过还是要面对IEhack (attachlistener)
>
>
>
>>>>
>>>> body.onElementLoad=function(element) {
>>>>    if(element.id=="content"){
>>>>        //do something
>>>>    }
>>>>
>>>>
>
>
> 如果我要do many things,就麻烦了
>
> body.onEvent = function1(){.....}
> body.onEvent = function2(){.....}
> body.onEvent = function3(){.....}
>
> function3会取代function2会取代function1
>
> 而eventlistener不会有这个问题
>
> addEventlistener(event,function1(), false)
> addEventlistener(event,function2(), false)
> addEventlistener(event,function3(), false)
>
> 不过PPK提过以上function1,2,3可能不会依次序实现。
>
>
>
>
>
Received on Friday, 22 October 2010 11:40:28 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:43:46 UTC