Skip to content
This repository has been archived by the owner on May 10, 2018. It is now read-only.

Commit

Permalink
Fixed regression and message text
Browse files Browse the repository at this point in the history
  • Loading branch information
uuf6429 committed May 27, 2017
1 parent 8db4994 commit e6675bc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
21 changes: 11 additions & 10 deletions src/Server/Preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,11 +371,12 @@
* @param {String} rdEventType
*/
'handleMouseEventOnce': function (rdEventType) {
const rdEventTypeToJsEventMap = {
'mouseMoved': 'mousemove',
'mousePressed': 'mousedown',
'mouseReleased': 'mouseup'
};
const self = this,
rdEventTypeToJsEventMap = {
'mouseMoved': 'mousemove',
'mousePressed': 'mousedown',
'mouseReleased': 'mouseup'
};

if (!rdEventTypeToJsEventMap[rdEventType]) {
throw new Error('RemoteDebug event named "' + rdEventType + '" is not supported.');
Expand All @@ -385,7 +386,7 @@
rdEventTypeToJsEventMap[rdEventType],
function (event) {
setMouseEventTriggered(
(event && event.target) ? this.getElementSelector(event.target) : 'unknown'
(event && event.target) ? self._getElementSelector(event.target) : 'unknown'
);
},
{catpure: true, once: true}
Expand All @@ -396,16 +397,16 @@
* @param {HTMLElement} element
* @returns {String}
*/
'getElementSelector': function (element){
'_getElementSelector': function (element){
if (element.id) {
return '#' + element.id;
}

let parent = element.parentNode;
let selector = '>' + element.nodeName + ':nth-child(' + this.getElementIndex(element) + ')';
let selector = '>' + element.nodeName + ':nth-child(' + this._getElementIndex(element) + ')';

while (!parent.id && parent.nodeName.toLowerCase() !== 'body') {
selector = '>' + element.nodeName + ':nth-child(' + this.getElementIndex(parent) + ')' + selector;
selector = '>' + element.nodeName + ':nth-child(' + this._getElementIndex(parent) + ')' + selector;
parent = parent.parentNode;
}

Expand All @@ -422,7 +423,7 @@
* @param {Node} element
* @returns {Number}
*/
'getElementIndex': function(element) {
'_getElementIndex': function(element) {
let i = 0;
while (!!(element = element.previousSibling)) i++;
return i;
Expand Down
2 changes: 1 addition & 1 deletion src/Server/Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,7 @@ Electron.app.on('ready', function() {
);
})
.catch(function (error) {
Logger.error('Could create mouse event listener (%j): %s', params, errorToString(error));
Logger.error('Could not create mouse event listener (%j): %s', params, errorToString(error));
executeResponse = {'error': errorToString(error)};
});

Expand Down

0 comments on commit e6675bc

Please sign in to comment.