Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-5869

Kittencaptcha doesn't calculate click y-coordinate correctly

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 6.14.0, 6.15.0, 6.16.0, 6.17.0, 6.18.0, 6.19.0
    • 6.20.0, 7.0.0-M6
    • wicket-extensions
    • None

    Description

      In firefox the click event doesn't calculate the relative position of the click correctly.

      In the block when the event doesn't have an offsetX/Y, the code should take into account all offsets of all offsetParents. The code below fixes this.

      function getEventX(element, event) {
      	var result;
      	if (event.offsetX != null) {
      		result = event.offsetX;
      	} else {
      		result = event.pageX;
      		do {
      			result = result - element.offsetLeft;
      			element = element.offsetParent;
      		} while (element != null)
      	}
      	return parseInt(result, 10);
      }
      function getEventY(element, event) {
      	var result;
      	if (event.offsetY != null) {
      		result = event.offsetY;
      	} else {
      		result = event.pageY;
      		do {
      			result = result - element.offsetTop;
      			element = element.offsetParent;
      		} while (element != null)
      	}
      	return parseInt(result, 10);
      }
      

      Attachments

        Activity

          People

            dashorst Martijn Dashorst
            dashorst Martijn Dashorst
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: