Skip to content
This repository has been archived by the owner on Apr 15, 2022. It is now read-only.

Commit

Permalink
added pageX and pageY
Browse files Browse the repository at this point in the history
  • Loading branch information
WebReflection committed Apr 4, 2016
1 parent 1419934 commit dd1582f
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build/ie8.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 24 additions & 1 deletion build/ie8.max.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,27 @@ THE SOFTWARE.
}
}

function pageGetter(coord) {
var
Dir = (coord === 'X' ? 'Left' : 'Top'),
clientXY = 'client' + coord,
clientLR = 'client' + Dir,
scrollLR = 'scroll' + Dir,
secretXY = '_@' + clientXY
;
return function get() {
/* jshint validthis:true */
return this[secretXY] || (
this[secretXY] = (
this[clientXY] + (
html[scrollLR] || (document.body && document.body[scrollLR]) || 0
) -
html[clientLR]
)
);
};
}

function setTextContent(textContent) {
var node;
while ((node = this.lastChild)) {
Expand Down Expand Up @@ -542,7 +563,9 @@ THE SOFTWARE.
if (!this.bubbles) {
this.stopPropagation();
}
}}
}},
pageX: {get: pageGetter('X')},
pageY: {get: pageGetter('Y')}
}
);

Expand Down
25 changes: 24 additions & 1 deletion src/ie8.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,27 @@
}
}

function pageGetter(coord) {
var
Dir = (coord === 'X' ? 'Left' : 'Top'),
clientXY = 'client' + coord,
clientLR = 'client' + Dir,
scrollLR = 'scroll' + Dir,
secretXY = '_@' + clientXY
;
return function get() {
/* jshint validthis:true */
return this[secretXY] || (
this[secretXY] = (
this[clientXY] + (
html[scrollLR] || (document.body && document.body[scrollLR]) || 0
) -
html[clientLR]
)
);
};
}

function setTextContent(textContent) {
var node;
while ((node = this.lastChild)) {
Expand Down Expand Up @@ -520,7 +541,9 @@
if (!this.bubbles) {
this.stopPropagation();
}
}}
}},
pageX: {get: pageGetter('X')},
pageY: {get: pageGetter('Y')}
}
);

Expand Down

0 comments on commit dd1582f

Please sign in to comment.