@@ -8,35 +8,42 @@ export function genId() {
88}
99
1010export function addDocumentObjectHelpers ( ) {
11- Object . defineProperty ( Element . prototype , 'documentOffsetTop' , {
12- get : function ( ) {
11+ if ( ! Element . prototype . hasOwnProperty ( 'documentOffsetTop' ) ) {
12+ Object . defineProperty ( Element . prototype , 'documentOffsetTop' , {
13+ get : function ( ) {
1314 return this . offsetTop + ( this . offsetParent ? this . offsetParent . documentOffsetTop : 0 ) ;
14- }
15- } ) ;
16-
17- Object . defineProperty ( Element . prototype , 'documentOffsetLeft' , {
15+ }
16+ } ) ;
17+ }
18+ if ( ! Element . prototype . hasOwnProperty ( 'documentOffsetLeft' ) ) {
19+ Object . defineProperty ( Element . prototype , 'documentOffsetLeft' , {
1820 get : function ( ) {
19- return this . offsetLeft + ( this . offsetParent ? this . offsetParent . documentOffsetLeft : 0 ) ;
21+ return this . offsetLeft + ( this . offsetParent ? this . offsetParent . documentOffsetLeft : 0 ) ;
2022 }
21- } ) ;
23+ } ) ;
24+ }
2225
23- Object . defineProperty ( Element . prototype , 'documentClientWidth' , {
26+ if ( ! Element . prototype . hasOwnProperty ( 'documentClientWidth' ) ) {
27+ Object . defineProperty ( Element . prototype , 'documentClientWidth' , {
2428 get : function ( ) {
25- return this . getBoundingClientRect ( ) . width ;
29+ return this . getBoundingClientRect ( ) . width ;
2630 }
27- } ) ;
31+ } ) ;
32+ }
2833
29- Object . defineProperty ( Element . prototype , 'documentClientHeight' , {
34+ if ( ! Element . prototype . hasOwnProperty ( 'documentClientHeight' ) ) {
35+ Object . defineProperty ( Element . prototype , 'documentClientHeight' , {
3036 get : function ( ) {
31- return this . getBoundingClientRect ( ) . height ;
37+ return this . getBoundingClientRect ( ) . height ;
3238 }
33- } ) ;
39+ } ) ;
40+ }
3441
35- String . prototype . ptroTrim = function ( )
36- {
42+ if ( ! String . prototype . hasOwnProperty ( 'ptroTrim' ) ) {
43+ String . prototype . ptroTrim = function ( ) {
3744 return String ( this ) . replace ( / ^ \s + | \s + $ / g, '' ) ;
38- } ;
39-
45+ } ;
46+ }
4047}
4148
4249export function clearSelection ( ) {
0 commit comments