路宁(luning)的博客

流行的管理体系很摧残人。人与生俱来的,是激情和固有的内在动机、自重、尊严、好奇心和学习的快乐。而摧毁这些的外力从幼儿学步时就陆续出现了,如万圣节最佳服饰奖、学校的分数、金色五角星等等,类似的东西一直持续到大学。在职场,人群、团队、小组被分出等级,位居前列的获得奖励,落在后面的受到惩罚。目标管理、配额、奖金、商业计划,这些加在一起,一步步地加深这种损害 - 一种尚未得知也不可得知的损害。 - 爱德华.戴明
    <<  A Quick Check of Javascript Code Quality | Home | Remove the Noisy Thread.Sleep and WaitForCondition from Selenium Tests  >>
  • Code Snippet to Log All Events as They Are Triggered - [Javascript]

    2009-04-28

    I paired with Josh Price wrote the javascript code below, just before that we noticed something abnormal about event handling and wanted to find out what happened.

    Just paste the code below into Firebug console of Firefox, run it, do something triggering events in page and watch the log printed out.

    Please note that this requires jQuery.

    var counter = 0;
    $("*").each(function() {
      var events = $(this).data('events');
      if(events) {
        $.each(events, function(type, handlers) {
          $.each(handlers, function(i, handler){
            handlers[i] = function(){
              handler.apply(this, arguments);
              console.log(++counter, type);
            };
          });
        });
      }
    });
    

     
    You can add more logging per your need, e.g. the time used for each handler call.

     


    收藏到:Del.icio.us
    Tag:Javascript Firebug Firefox Events
    Cite url:
    luning published this at 19:18:38 | Edit | Continue This Topic | Forward | 分享 0
  • RSS EMail Me

Search

Latest logs

  • 编写Story的一周,预示了项目的不祥未来
  • 试用了一下Team Foundation Server中的版本管理功能
  • Share DOM Fixtures between JavaScript Unit Tests
  • Manage Mock Dependencies of Controllers with IoC Container
  • The Waste from Very Fat to Very Lean's Perspective
  • A Misleading Analogy between Software Development and Manufacturing
  • Selenium Test Powered by jQuery.parcel
  • Remove the Noisy Thread.Sleep and WaitForCondition from Selenium Tests
  • Code Snippet to Log All Events as They Are Triggered
  • A Quick Check of Javascript Code Quality
全部日志>>

Comments

  • 改单: 呵呵 支持下博主
  • 腰椎间盘突出:其实这个软件还是不错的...
  • 腰椎间盘突出:坚持就是胜利
  • 左旋肉碱有用吗:好文章啊!期待精彩下文。。。。...
  • SomeOne:[很强大,就是思路偏了,适合给大领导看,不适合给团队用。...
  • yeka: 信! gigix告诉我你的博客——博文视点 y...
  • Andy Yuan:看了你的切身体会,非常不错。支持...
  • hunk:感谢分享,期待精彩下文。...
  • taowen:http://taowen.github.com/bay...
  • dewwind88:呵呵,我信!我也是自己深有同感~-网络上的陌生人,搜索到...

Categories

  • Lean[21]
  • Software Development[2]
  • Agile[16]
  • Life[1]
  • Economics[3]
  • Misc[0]
  • Test[7]
  • Javascript[3]
  • Version Control[1]

Tag

  • 敏捷[33]
  • 精益[29]
  • Agile[23]
  • 软件开发[19]
  • Lean[15]
More..