docs: function(comp, x, y) {
          var tar = x.target || x.srcElement || Crafty.stage.elem;
          y = typeof y !== "undefined" ? y : x.clientY;
          x = typeof x.clientX !== "undefined" ? x.clientX : x;
  
          var closest = null,
              current,
              q,
              l,
              i,
              pos,
              maxz = -Infinity;
  
          //if it's a DOM element with component we are done
          if (tar.nodeName !== "CANVAS") {
              while (typeof tar.id !== "string" && tar.id.indexOf("ent") === -1) {
                  tar = tar.parentNode;
              }
              var ent = Crafty(parseInt(tar.id.replace("ent", ""), 10));
              pos = Crafty.domHelper.translate(x, y, ent._drawLayer);
              if (ent.__c[comp] && ent.isAt(pos.x, pos.y)) {
                  closest = ent;
              }
          }
  
          //else we search for an entity with component
          if (!closest) {
              // Loop through each layer
              for (var layerIndex in Crafty._drawLayers) {
                  var layer = Crafty._drawLayers[layerIndex];
  
                  // Skip a layer if it has no entities listening for pointer events
                  if (layer._pointerEntities <= 0) continue;
  
                  // Get the position in this layer
                  pos = Crafty.domHelper.translate(x, y, layer);
                  q = Crafty.map.unfilteredSearch({
                      _x: pos.x,
                      _y: pos.y,
                      _w: 1,
                      _h: 1
                  });
  
                  for (i = 0, l = q.length; i < l; ++i) {
                      current = q[i];
                      if (
                          current._visible &&
                          current._drawLayer === layer &&
                          current._globalZ > maxz &&
                          current.__c[comp] &&
                          current.isAt(pos.x, pos.y)
                      ) {
                          maxz = current._globalZ;
                          closest = current;
                      }
                  }
              }
          }
  
          return closest;
      }