test('bind/unbind click handler to document', function() {
  var clicked = 0;

  function handle() {
    clicked++;
  }

  equal(clicked, 0);

  $(document).on('click', handle);
  $(document).trigger('click');
  equal(clicked, 1);
  $(document.body).trigger('click');
  equal(clicked, 2);

  $(document).off('click', handle);
  $(document).trigger('click');
  equal(clicked, 2);
});

test('bind/unbind delegated click handler to document', function() {
  var clicked = 0;

  function handle() {
    clicked++;
  }

  equal(clicked, 0);

  $(document).on('click', 'body', handle);
  $(document).trigger('click');
  equal(clicked, 0);
  $(document.body).trigger('click');
  equal(clicked, 1);

  $(document).off('click', 'body', handle);
  $(document.body).trigger('click');
  equal(clicked, 1);
});

@@ -787,12 +787,849 @@
 ed, 1);%0A%7D);%0A
+%0Atest('bind/unbind namespaced click handler to document', function() %7B%0A  var clicked = 0;%0A%0A  function handle() %7B%0A    clicked++;%0A  %7D%0A%0A  equal(clicked, 0);%0A%0A  $(document).on('click.foo', handle);%0A  $(document).trigger('click');%0A  equal(clicked, 1);%0A  $(document.body).trigger('click');%0A  equal(clicked, 2);%0A%0A  $(document).off('click.foo', handle);%0A  $(document).trigger('click');%0A  equal(clicked, 2);%0A%7D);%0A%0Atest('bind/unbind delegated namespaced click handler to document', function() %7B%0A  var clicked = 0;%0A%0A  function handle() %7B%0A    clicked++;%0A  %7D%0A%0A  equal(clicked, 0);%0A%0A  $(document).on('click.foo', 'body', handle);%0A  $(document).trigger('click');%0A  equal(clicked, 0);%0A  $(document.body).trigger('click');%0A  equal(clicked, 1);%0A%0A  $(document).off('click.foo', 'body', handle);%0A  $(document.body).trigger('click');%0A  equal(clicked, 1);%0A%7D);%0A

Test event namespaces