一些浏览器的Javascript事件冗余 [英] Javascript event redundancy with some browsers

查看:71
本文介绍了一些浏览器的Javascript事件冗余的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

----------------------------------------------- ------------------------------------

问题1:

--------------------------------------------- --------------------------------------

>亲爱的先生。

>

>我已将您的sorttable.js模块集成到我的Web应用程序中作为

>可怜的网络JavaScript开发人员初学者:

>

>请在我的新网站的Creative部分查看结果:

>

> http://www.danielpisters.eu/

>

>或者

>

> http://www.imaginenigma.com/

>

>或者很快(如同愚蠢的民族主义要求)

>

> http://www.danielpisters.be

>

>此站点是从Dreamweaver CS6构建的。在我的Internet Explorer 8上

> (还有Windows XP),当我点击标题栏时,内容

>完全按升序或降序排序。但是对于Google

> Chrome或Safari,排序不起作用;它只排序一次

>按降序排列。您能否建议我将代码更改为

>匹配这些该死的浏览器的特性?

>

>我提前谢谢你,

>

> Daniel Pisters



-------------------------------- -------------------------------------------------

回答问题I

------------------------------- --------------------------------------------------

-----------------------------------------------------------------------------------
Question 1:
-----------------------------------------------------------------------------------
> Dear Sir.
>
> I have integrated your sorttable.js module in my web application as a
> poor web JavaScript developer beginner :
>
> Please see the result on the Creative part of my new website :
>
> http://www.danielpisters.eu/
>
> or
>
> http://www.imaginenigma.com/
>
> or soon (as stupid nationalism requires)
>
> http://www.danielpisters.be
>
> This site is build from Dreamweaver CS6. On my Internet Explorer 8
> (yet with Windows XP) , when I click on a header column, the content
> is perfectly sorted in ascending or descending order. But with Google
> Chrome or Safari, the sorting does not work ; it is sorted only once
> in descending order. Can you suggest me a way to change your code to
> match the specificities of these damned browsers?
>
> I thank you in advance,
>
> Daniel Pisters

---------------------------------------------------------------------------------
Answer to Question I
---------------------------------------------------------------------------------

Your problem, according to the web console in Firefox, is being throws by thiscode:

<script>
$(function() {
 $("#panel").sortable({
 items: ".content",
 forcePlaceholderSize: true
 }).disableSelection();
 $(".content").disableSelection();}
);
  </script>

I don't know what that code is, I'm afraid; it doesn't seem to have anything to do with my sorttable.js :-)

sil





-------------------------------------------------- ---------------------------------

问题II

------------------------------------------------- ----------------------------------



亲爱的先生,



首先,我非常感谢你的快速反应。



我将您指出的代码评论为可能有罪并且它没有改变任何内容以便我对其进行取消注释。

我已经在IE,Firefox,Google Chrome和Safari上测试了您的代码。谷歌Chrome被认为是一个组合的,混合的Opera / Safari,可能来自遗留下来的这个新怪物的构建;)



与第一个(IE)相比,那些浏览器捕获点击事件有不同的行为;也就是说:对于同一事件,dean_AddEvent被调用两次,这样当列被排序时,它会以相反的顺序再次排序,导致列始终按相同的顺序排序(降序)。请看下面的序列:



加载页面后:



< click>

dean_addEvent

dean_addEvent

反向



< click>

dean_addEvent

re-reverse

dean_addEvent

反向



对于同一事件,sort会发生两次。



请注意,我在非Web系统,事件编程(如Oracle Forms 4.5等)中遇到过此类事件冗余。



我再说一遍,我只是一个可怜的JavaScript初学者。我不太喜欢这种编程风格,虽然它可能同时非常棘手和优雅,例如你的。没有类的objet语言可以理解它必须处理网页的动态这一事实,我认为这不允许将上游引用到静态定义,但是你和我一样预测它不会持续很长时间并且不久的将来是能够为Windows应用程序进行网络编程,而不会看到太多差异。除了那些哲学上的考虑之外,请帮助我,因为与我相比,你的JavaScript编程水平太高,无法假装调试并以正确的方式纠正它。



提前感谢,



Daniel Pisters



---------- -------------------------------------------------- -----------------------

这个序列可以在我的测试网站上找到:http://espritnegatif.businesscatalyst.com

------------------------------------------ -----------------------------------------



我提前谢谢大家,



Daniel Pisters



-----------------------------------------------------------------------------------
Question II
-----------------------------------------------------------------------------------

Dear Sir,

First, I have to thank you very much for your rapid reactivity.

I put in comment the code you have pointed out as probably guilty and it did not change anything so that I uncommented it.
I have tested your code on IE, Firefox, Google Chrome and Safari. Google Chrome is perceived as a combined, hybrid Opera/Safari probably from legacy upon which this new monster was build;)

Compared to the first (IE), those browsers have different behaviors in catching the click event; that is to say: dean_AddEvent is called twice for the same event so that when the column was sorted, it is sorted again in the reverse order, resulting in a column being always sorted in the same order (descending). Please, see the sequence bellow:

After loading the page:

<click>
dean_addEvent
dean_addEvent
reverse

<click>
dean_addEvent
re-reverse
dean_addEvent
reverse

The sort occurs twice for the same event.

Note however that I have experienced such event redundancy in non web system, event programming such as Oracle Forms 4.5 and so on for Windows.

I repeat that I am only a poor JavaScript beginner. I don''t like very much this programming style, though it may be very tricky and elegant at the same time, such as yours. An objet language without class can be understood by the fact it has to deal with the dynamic of web pages, which does not allow referring upstream to static definitions, I suppose, but you are foreseeing as well as me that it will not last very long and that the near future is to be able programming for the web as for a windows application, without seeing much difference. Beside those philosophical considerations, please help me, because your programming level in JavaScript is too high in comparison with mine to allow pretending to debug it and correct it in the right way.

Thank in advance,

Daniel Pisters

-----------------------------------------------------------------------------------
This sequence can be traced on my test website: http://espritnegatif.businesscatalyst.com
-----------------------------------------------------------------------------------

I thanks you all in advance,

Daniel Pisters

推荐答案

( function(){
(function() {


(#panel)。sortable({
items:。content,
forcePlaceholderSize:true
})。 disableSelection();
("#panel").sortable({ items: ".content", forcePlaceholderSize: true }).disableSelection();


(。content)。disableSelection();}
);
< / script >

我不知道那个代码是什么,我害怕;它似乎与我的sorttable.js没有任何关系:-)

sil
(".content").disableSelection();} ); </script> I don't know what that code is, I'm afraid; it doesn't seem to have anything to do with my sorttable.js :-) sil





-------------------------------------------------- ---------------------------------

问题II

------------------------------------------------- ----------------------------------



亲爱的先生,



首先,我非常感谢你的快速反应。



我将您指出的代码评论为可能有罪并且它没有改变任何内容以便我对其进行取消注释。

我已经在IE,Firefox,Google Chrome和Safari上测试了您的代码。谷歌Chrome被认为是一个组合的,混合的Opera / Safari,可能来自遗留下来的这个新怪物的构建;)



与第一个(IE)相比,那些浏览器捕获点击事件有不同的行为;也就是说:对于同一事件,dean_AddEvent被调用两次,这样当列被排序时,它会以相反的顺序再次排序,导致列始终按相同的顺序排序(降序)。请看下面的序列:



加载页面后:



< click>

dean_addEvent

dean_addEvent

反向



< click>

dean_addEvent

re-reverse

dean_addEvent

反向



对于同一事件,sort会发生两次。



请注意,我在非Web系统,事件编程(如Oracle Forms 4.5等)中遇到过此类事件冗余。



我再说一遍,我只是一个可怜的JavaScript初学者。我不太喜欢这种编程风格,虽然它可能同时非常棘手和优雅,例如你的。没有类的objet语言可以理解它必须处理网页的动态这一事实,我认为这不允许将上游引用到静态定义,但是你和我一样预测它不会持续很长时间并且不久的将来是能够为Windows应用程序进行网络编程,而不会看到太多差异。除了那些哲学上的考虑之外,请帮助我,因为与我相比,你的JavaScript编程水平太高,无法假装调试并以正确的方式纠正它。



提前感谢,



Daniel Pisters



---------- -------------------------------------------------- -----------------------

这个序列可以在我的测试网站上找到:http://espritnegatif.businesscatalyst.com

------------------------------------------ -----------------------------------------



我提前谢谢大家,



Daniel Pisters



-----------------------------------------------------------------------------------
Question II
-----------------------------------------------------------------------------------

Dear Sir,

First, I have to thank you very much for your rapid reactivity.

I put in comment the code you have pointed out as probably guilty and it did not change anything so that I uncommented it.
I have tested your code on IE, Firefox, Google Chrome and Safari. Google Chrome is perceived as a combined, hybrid Opera/Safari probably from legacy upon which this new monster was build;)

Compared to the first (IE), those browsers have different behaviors in catching the click event; that is to say: dean_AddEvent is called twice for the same event so that when the column was sorted, it is sorted again in the reverse order, resulting in a column being always sorted in the same order (descending). Please, see the sequence bellow:

After loading the page:

<click>
dean_addEvent
dean_addEvent
reverse

<click>
dean_addEvent
re-reverse
dean_addEvent
reverse

The sort occurs twice for the same event.

Note however that I have experienced such event redundancy in non web system, event programming such as Oracle Forms 4.5 and so on for Windows.

I repeat that I am only a poor JavaScript beginner. I don''t like very much this programming style, though it may be very tricky and elegant at the same time, such as yours. An objet language without class can be understood by the fact it has to deal with the dynamic of web pages, which does not allow referring upstream to static definitions, I suppose, but you are foreseeing as well as me that it will not last very long and that the near future is to be able programming for the web as for a windows application, without seeing much difference. Beside those philosophical considerations, please help me, because your programming level in JavaScript is too high in comparison with mine to allow pretending to debug it and correct it in the right way.

Thank in advance,

Daniel Pisters

-----------------------------------------------------------------------------------
This sequence can be traced on my test website: http://espritnegatif.businesscatalyst.com
-----------------------------------------------------------------------------------

I thanks you all in advance,

Daniel Pisters


这篇关于一些浏览器的Javascript事件冗余的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆