@whitesev/domutils 1.5.11 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.amd.js +43 -75
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +43 -75
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +43 -75
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +43 -75
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +43 -75
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +43 -75
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/DOMUtils.d.ts +6 -6
- package/dist/types/src/types/DOMUtilsEvent.d.ts +2 -1
- package/package.json +5 -3
- package/src/DOMUtils.ts +86 -257
- package/src/DOMUtilsCommonUtils.ts +1 -4
- package/src/DOMUtilsData.ts +1 -3
- package/src/DOMUtilsEvent.ts +40 -174
- package/src/types/DOMUtilsEvent.d.ts +2 -1
package/dist/index.system.js
CHANGED
|
@@ -283,7 +283,7 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
283
283
|
};
|
|
284
284
|
|
|
285
285
|
// This is the minified and stringified code of the worker-timers-worker package.
|
|
286
|
-
const worker = `(()=>{var e={455:function(e,t){!function(e){"use strict";var t=function(e){return function(t){var r=e(t);return t.add(r),r}},r=function(e){return function(t,r){return e.set(t,r),r}},n=void 0===Number.MAX_SAFE_INTEGER?9007199254740991:Number.MAX_SAFE_INTEGER,o=536870912,s=2*o,a=function(e,t){return function(r){var a=t.get(r),i=void 0===a?r.size:a<s?a+1:0;if(!r.has(i))return e(r,i);if(r.size<o){for(;r.has(i);)i=Math.floor(Math.random()*s);return e(r,i)}if(r.size>n)throw new Error("Congratulations, you created a collection of unique numbers which uses all available integers!");for(;r.has(i);)i=Math.floor(Math.random()*n);return e(r,i)}},i=new WeakMap,u=r(i),c=a(u,i),
|
|
286
|
+
const worker = `(()=>{var e={455:function(e,t){!function(e){"use strict";var t=function(e){return function(t){var r=e(t);return t.add(r),r}},r=function(e){return function(t,r){return e.set(t,r),r}},n=void 0===Number.MAX_SAFE_INTEGER?9007199254740991:Number.MAX_SAFE_INTEGER,o=536870912,s=2*o,a=function(e,t){return function(r){var a=t.get(r),i=void 0===a?r.size:a<s?a+1:0;if(!r.has(i))return e(r,i);if(r.size<o){for(;r.has(i);)i=Math.floor(Math.random()*s);return e(r,i)}if(r.size>n)throw new Error("Congratulations, you created a collection of unique numbers which uses all available integers!");for(;r.has(i);)i=Math.floor(Math.random()*n);return e(r,i)}},i=new WeakMap,u=r(i),c=a(u,i),l=t(c);e.addUniqueNumber=l,e.generateUniqueNumber=c}(t)}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var s=t[n]={exports:{}};return e[n].call(s.exports,s,s.exports,r),s.exports}(()=>{"use strict";const e=-32603,t=-32602,n=-32601,o=(e,t)=>Object.assign(new Error(e),{status:t}),s=t=>o('The handler of the method called "'.concat(t,'" returned an unexpected result.'),e),a=(t,r)=>async({data:{id:a,method:i,params:u}})=>{const c=r[i];try{if(void 0===c)throw(e=>o('The requested method called "'.concat(e,'" is not supported.'),n))(i);const r=void 0===u?c():c(u);if(void 0===r)throw(t=>o('The handler of the method called "'.concat(t,'" returned no required result.'),e))(i);const l=r instanceof Promise?await r:r;if(null===a){if(void 0!==l.result)throw s(i)}else{if(void 0===l.result)throw s(i);const{result:e,transferables:r=[]}=l;t.postMessage({id:a,result:e},r)}}catch(e){const{message:r,status:n=-32603}=e;t.postMessage({error:{code:n,message:r},id:a})}};var i=r(455);const u=new Map,c=(e,r,n)=>({...r,connect:({port:t})=>{t.start();const n=e(t,r),o=(0,i.generateUniqueNumber)(u);return u.set(o,(()=>{n(),t.close(),u.delete(o)})),{result:o}},disconnect:({portId:e})=>{const r=u.get(e);if(void 0===r)throw(e=>o('The specified parameter called "portId" with the given value "'.concat(e,'" does not identify a port connected to this worker.'),t))(e);return r(),{result:null}},isSupported:async()=>{if(await new Promise((e=>{const t=new ArrayBuffer(0),{port1:r,port2:n}=new MessageChannel;r.onmessage=({data:t})=>e(null!==t),n.postMessage(t,[t])}))){const e=n();return{result:e instanceof Promise?await e:e}}return{result:!1}}}),l=(e,t,r=()=>!0)=>{const n=c(l,t,r),o=a(e,n);return e.addEventListener("message",o),()=>e.removeEventListener("message",o)},d=(e,t)=>r=>{const n=t.get(r);if(void 0===n)return Promise.resolve(!1);const[o,s]=n;return e(o),t.delete(r),s(!1),Promise.resolve(!0)},f=(e,t,r,n)=>(o,s,a)=>{const i=o+s-t.timeOrigin,u=i-t.now();return new Promise((t=>{e.set(a,[r(n,u,i,e,t,a),t])}))},m=new Map,h=d(globalThis.clearTimeout,m),p=new Map,v=d(globalThis.clearTimeout,p),w=((e,t)=>{const r=(n,o,s,a)=>{const i=n-e.now();i>0?o.set(a,[t(r,i,n,o,s,a),s]):(o.delete(a),s(!0))};return r})(performance,globalThis.setTimeout),g=f(m,performance,globalThis.setTimeout,w),T=f(p,performance,globalThis.setTimeout,w);l(self,{clear:async({timerId:e,timerType:t})=>({result:await("interval"===t?h(e):v(e))}),set:async({delay:e,now:t,timerId:r,timerType:n})=>({result:await("interval"===n?g:T)(e,t,r)})})})()})();`; // tslint:disable-line:max-line-length
|
|
287
287
|
|
|
288
288
|
const loadOrReturnBroker = createLoadOrReturnBroker(load, worker);
|
|
289
289
|
const clearInterval = (timerId) => loadOrReturnBroker().clearInterval(timerId);
|
|
@@ -605,8 +605,7 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
605
605
|
: event.target;
|
|
606
606
|
let totalParent = elementItem;
|
|
607
607
|
if (DOMUtilsCommonUtils.isWin(totalParent)) {
|
|
608
|
-
if (totalParent ===
|
|
609
|
-
DOMUtilsContext.windowApi.document) {
|
|
608
|
+
if (totalParent === DOMUtilsContext.windowApi.document) {
|
|
610
609
|
totalParent = DOMUtilsContext.windowApi.document.documentElement;
|
|
611
610
|
}
|
|
612
611
|
}
|
|
@@ -674,8 +673,7 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
674
673
|
if (typeof currentParam === "boolean") {
|
|
675
674
|
option.capture = currentParam;
|
|
676
675
|
}
|
|
677
|
-
else if (typeof currentParam === "object" &&
|
|
678
|
-
"capture" in currentParam) {
|
|
676
|
+
else if (typeof currentParam === "object" && "capture" in currentParam) {
|
|
679
677
|
option.capture = currentParam.capture;
|
|
680
678
|
}
|
|
681
679
|
return option;
|
|
@@ -737,8 +735,7 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
737
735
|
// 目标函数、事件名
|
|
738
736
|
isRemoveAll = true;
|
|
739
737
|
}
|
|
740
|
-
else if ((args.length === 3 && typeof args[2] === "string") ||
|
|
741
|
-
Array.isArray(args[2])) {
|
|
738
|
+
else if ((args.length === 3 && typeof args[2] === "string") || Array.isArray(args[2])) {
|
|
742
739
|
// 目标函数、事件名、子元素选择器
|
|
743
740
|
isRemoveAll = true;
|
|
744
741
|
}
|
|
@@ -753,9 +750,7 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
753
750
|
for (let index = 0; index < handlers.length; index++) {
|
|
754
751
|
let handler = handlers[index];
|
|
755
752
|
let flag = true;
|
|
756
|
-
if (flag &&
|
|
757
|
-
listenerCallBack &&
|
|
758
|
-
handler.originCallBack !== listenerCallBack) {
|
|
753
|
+
if (flag && listenerCallBack && handler.originCallBack !== listenerCallBack) {
|
|
759
754
|
// callback不同
|
|
760
755
|
flag = false;
|
|
761
756
|
}
|
|
@@ -815,9 +810,7 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
815
810
|
return;
|
|
816
811
|
}
|
|
817
812
|
let elementEvents = elementItem[symbolEvents] || {};
|
|
818
|
-
let iterEventNameList = eventTypeList.length
|
|
819
|
-
? eventTypeList
|
|
820
|
-
: Object.keys(elementEvents);
|
|
813
|
+
let iterEventNameList = eventTypeList.length ? eventTypeList : Object.keys(elementEvents);
|
|
821
814
|
iterEventNameList.forEach((eventName) => {
|
|
822
815
|
let handlers = elementEvents[eventName];
|
|
823
816
|
if (!handlers) {
|
|
@@ -854,8 +847,7 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
854
847
|
try {
|
|
855
848
|
if (DOMUtilsContext.windowApi.document.readyState === "complete" ||
|
|
856
849
|
(DOMUtilsContext.windowApi.document.readyState !== "loading" &&
|
|
857
|
-
!DOMUtilsContext.windowApi.document.documentElement
|
|
858
|
-
.doScroll)) {
|
|
850
|
+
!DOMUtilsContext.windowApi.document.documentElement.doScroll)) {
|
|
859
851
|
return true;
|
|
860
852
|
}
|
|
861
853
|
else {
|
|
@@ -1490,7 +1482,7 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
1490
1482
|
super(option);
|
|
1491
1483
|
}
|
|
1492
1484
|
/** 版本号 */
|
|
1493
|
-
version = "2025.
|
|
1485
|
+
version = "2025.8.9";
|
|
1494
1486
|
attr(element, attrName, attrValue) {
|
|
1495
1487
|
let DOMUtilsContext = this;
|
|
1496
1488
|
if (typeof element === "string") {
|
|
@@ -1584,15 +1576,7 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
1584
1576
|
* 把纯数字没有px的加上
|
|
1585
1577
|
*/
|
|
1586
1578
|
function handlePixe(propertyName, propertyValue) {
|
|
1587
|
-
let allowAddPixe = [
|
|
1588
|
-
"width",
|
|
1589
|
-
"height",
|
|
1590
|
-
"top",
|
|
1591
|
-
"left",
|
|
1592
|
-
"right",
|
|
1593
|
-
"bottom",
|
|
1594
|
-
"font-size",
|
|
1595
|
-
];
|
|
1579
|
+
let allowAddPixe = ["width", "height", "top", "left", "right", "bottom", "font-size"];
|
|
1596
1580
|
if (typeof propertyValue === "number") {
|
|
1597
1581
|
propertyValue = propertyValue.toString();
|
|
1598
1582
|
}
|
|
@@ -1634,8 +1618,7 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
1634
1618
|
return;
|
|
1635
1619
|
}
|
|
1636
1620
|
let setStyleProperty = (propertyName, propertyValue) => {
|
|
1637
|
-
if (typeof propertyValue === "string" &&
|
|
1638
|
-
propertyValue.trim().endsWith("!important")) {
|
|
1621
|
+
if (typeof propertyValue === "string" && propertyValue.trim().endsWith("!important")) {
|
|
1639
1622
|
propertyValue = propertyValue
|
|
1640
1623
|
.trim()
|
|
1641
1624
|
.replace(/!important$/gi, "")
|
|
@@ -1649,9 +1632,7 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
1649
1632
|
};
|
|
1650
1633
|
if (typeof property === "string") {
|
|
1651
1634
|
if (value == null) {
|
|
1652
|
-
return DOMUtilsContext.windowApi.globalThis
|
|
1653
|
-
.getComputedStyle(element)
|
|
1654
|
-
.getPropertyValue(property);
|
|
1635
|
+
return DOMUtilsContext.windowApi.globalThis.getComputedStyle(element).getPropertyValue(property);
|
|
1655
1636
|
}
|
|
1656
1637
|
else {
|
|
1657
1638
|
setStyleProperty(property, value);
|
|
@@ -1754,12 +1735,8 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
1754
1735
|
return transformInfo;
|
|
1755
1736
|
}
|
|
1756
1737
|
let elementTransform = DOMUtilsContext.windowApi.globalThis.getComputedStyle(element).transform;
|
|
1757
|
-
if (elementTransform != null &&
|
|
1758
|
-
|
|
1759
|
-
elementTransform !== "") {
|
|
1760
|
-
let elementTransformSplit = elementTransform
|
|
1761
|
-
.match(/\((.+)\)/)?.[1]
|
|
1762
|
-
.split(",");
|
|
1738
|
+
if (elementTransform != null && elementTransform !== "none" && elementTransform !== "") {
|
|
1739
|
+
let elementTransformSplit = elementTransform.match(/\((.+)\)/)?.[1].split(",");
|
|
1763
1740
|
if (elementTransformSplit) {
|
|
1764
1741
|
transform_left = Math.abs(parseInt(elementTransformSplit[4]));
|
|
1765
1742
|
transform_top = Math.abs(parseInt(elementTransformSplit[5]));
|
|
@@ -1797,8 +1774,7 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
1797
1774
|
}
|
|
1798
1775
|
if (value == null) {
|
|
1799
1776
|
// 获取
|
|
1800
|
-
if (element.localName === "input" &&
|
|
1801
|
-
(element.type === "checkbox" || element.type === "radio")) {
|
|
1777
|
+
if (element.localName === "input" && (element.type === "checkbox" || element.type === "radio")) {
|
|
1802
1778
|
return element.checked;
|
|
1803
1779
|
}
|
|
1804
1780
|
else {
|
|
@@ -1807,8 +1783,7 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
1807
1783
|
}
|
|
1808
1784
|
else {
|
|
1809
1785
|
// 设置
|
|
1810
|
-
if (element.localName === "input" &&
|
|
1811
|
-
(element.type === "checkbox" || element.type === "radio")) {
|
|
1786
|
+
if (element.localName === "input" && (element.type === "checkbox" || element.type === "radio")) {
|
|
1812
1787
|
element.checked = !!value;
|
|
1813
1788
|
}
|
|
1814
1789
|
else {
|
|
@@ -2062,7 +2037,15 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
2062
2037
|
}
|
|
2063
2038
|
function elementAppendChild(ele, text) {
|
|
2064
2039
|
if (typeof content === "string") {
|
|
2065
|
-
ele
|
|
2040
|
+
if (ele instanceof DocumentFragment) {
|
|
2041
|
+
if (typeof text === "string") {
|
|
2042
|
+
text = DOMUtilsContext.parseHTML(text, true, false);
|
|
2043
|
+
}
|
|
2044
|
+
ele.appendChild(text);
|
|
2045
|
+
}
|
|
2046
|
+
else {
|
|
2047
|
+
ele.insertAdjacentHTML("beforeend", DOMUtilsCommonUtils.getSafeHTML(text));
|
|
2048
|
+
}
|
|
2066
2049
|
}
|
|
2067
2050
|
else {
|
|
2068
2051
|
ele.appendChild(text);
|
|
@@ -2073,6 +2056,7 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
2073
2056
|
let fragment = DOMUtilsContext.windowApi.document.createDocumentFragment();
|
|
2074
2057
|
content.forEach((ele) => {
|
|
2075
2058
|
if (typeof ele === "string") {
|
|
2059
|
+
// 转为元素
|
|
2076
2060
|
ele = DOMUtilsContext.parseHTML(ele, true, false);
|
|
2077
2061
|
}
|
|
2078
2062
|
fragment.appendChild(ele);
|
|
@@ -2108,7 +2092,13 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
2108
2092
|
return;
|
|
2109
2093
|
}
|
|
2110
2094
|
if (typeof content === "string") {
|
|
2111
|
-
element
|
|
2095
|
+
if (element instanceof DocumentFragment) {
|
|
2096
|
+
content = DOMUtilsContext.parseHTML(content, true, false);
|
|
2097
|
+
element.prepend(content);
|
|
2098
|
+
}
|
|
2099
|
+
else {
|
|
2100
|
+
element.insertAdjacentHTML("afterbegin", DOMUtilsCommonUtils.getSafeHTML(content));
|
|
2101
|
+
}
|
|
2112
2102
|
}
|
|
2113
2103
|
else {
|
|
2114
2104
|
let $firstChild = element.firstChild;
|
|
@@ -2281,16 +2271,14 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
2281
2271
|
return;
|
|
2282
2272
|
}
|
|
2283
2273
|
if (DOMUtilsCommonUtils.isWin(element)) {
|
|
2284
|
-
return DOMUtilsContext.windowApi.window.document.documentElement
|
|
2285
|
-
.clientWidth;
|
|
2274
|
+
return DOMUtilsContext.windowApi.window.document.documentElement.clientWidth;
|
|
2286
2275
|
}
|
|
2287
2276
|
if (element.nodeType === 9) {
|
|
2288
2277
|
/* Document文档节点 */
|
|
2289
2278
|
element = element;
|
|
2290
2279
|
return Math.max(element.body.scrollWidth, element.documentElement.scrollWidth, element.body.offsetWidth, element.documentElement.offsetWidth, element.documentElement.clientWidth);
|
|
2291
2280
|
}
|
|
2292
|
-
if (isShow ||
|
|
2293
|
-
(!isShow && DOMUtilsCommonUtils.isShow(element))) {
|
|
2281
|
+
if (isShow || (!isShow && DOMUtilsCommonUtils.isShow(element))) {
|
|
2294
2282
|
/* 已显示 */
|
|
2295
2283
|
/* 不从style中获取对应的宽度,因为可能使用了class定义了width !important */
|
|
2296
2284
|
element = element;
|
|
@@ -2325,8 +2313,7 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
2325
2313
|
height(element, isShow = false) {
|
|
2326
2314
|
let DOMUtilsContext = this;
|
|
2327
2315
|
if (DOMUtilsCommonUtils.isWin(element)) {
|
|
2328
|
-
return DOMUtilsContext.windowApi.window.document.documentElement
|
|
2329
|
-
.clientHeight;
|
|
2316
|
+
return DOMUtilsContext.windowApi.window.document.documentElement.clientHeight;
|
|
2330
2317
|
}
|
|
2331
2318
|
if (typeof element === "string") {
|
|
2332
2319
|
element = DOMUtilsContext.selector(element);
|
|
@@ -2340,8 +2327,7 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
2340
2327
|
/* Document文档节点 */
|
|
2341
2328
|
return Math.max(element.body.scrollHeight, element.documentElement.scrollHeight, element.body.offsetHeight, element.documentElement.offsetHeight, element.documentElement.clientHeight);
|
|
2342
2329
|
}
|
|
2343
|
-
if (isShow ||
|
|
2344
|
-
(!isShow && DOMUtilsCommonUtils.isShow(element))) {
|
|
2330
|
+
if (isShow || (!isShow && DOMUtilsCommonUtils.isShow(element))) {
|
|
2345
2331
|
element = element;
|
|
2346
2332
|
/* 已显示 */
|
|
2347
2333
|
/* 从style中获取对应的高度,因为可能使用了class定义了width !important */
|
|
@@ -2469,8 +2455,7 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
2469
2455
|
let to = {};
|
|
2470
2456
|
for (let prop in styles) {
|
|
2471
2457
|
from[prop] =
|
|
2472
|
-
element.style[prop] ||
|
|
2473
|
-
DOMUtilsContext.windowApi.globalThis.getComputedStyle(element)[prop];
|
|
2458
|
+
element.style[prop] || DOMUtilsContext.windowApi.globalThis.getComputedStyle(element)[prop];
|
|
2474
2459
|
to[prop] = styles[prop];
|
|
2475
2460
|
}
|
|
2476
2461
|
let timer = DOMUtilsCommonUtils.setInterval(function () {
|
|
@@ -2480,8 +2465,7 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
2480
2465
|
progress = 1;
|
|
2481
2466
|
}
|
|
2482
2467
|
for (let prop in styles) {
|
|
2483
|
-
element.style[prop] =
|
|
2484
|
-
from[prop] + (to[prop] - from[prop]) * progress + "px";
|
|
2468
|
+
element.style[prop] = from[prop] + (to[prop] - from[prop]) * progress + "px";
|
|
2485
2469
|
}
|
|
2486
2470
|
if (progress === 1) {
|
|
2487
2471
|
DOMUtilsCommonUtils.clearInterval(timer);
|
|
@@ -2566,8 +2550,7 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
2566
2550
|
if (element == null) {
|
|
2567
2551
|
return;
|
|
2568
2552
|
}
|
|
2569
|
-
return Array.from(element.parentElement
|
|
2570
|
-
.children).filter((child) => child !== element);
|
|
2553
|
+
return Array.from(element.parentElement.children).filter((child) => child !== element);
|
|
2571
2554
|
}
|
|
2572
2555
|
/**
|
|
2573
2556
|
* 获取当前元素的父元素
|
|
@@ -2643,14 +2626,7 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
2643
2626
|
if (element.name &&
|
|
2644
2627
|
!element.disabled &&
|
|
2645
2628
|
(element.checked ||
|
|
2646
|
-
[
|
|
2647
|
-
"text",
|
|
2648
|
-
"hidden",
|
|
2649
|
-
"password",
|
|
2650
|
-
"textarea",
|
|
2651
|
-
"select-one",
|
|
2652
|
-
"select-multiple",
|
|
2653
|
-
].includes(element.type))) {
|
|
2629
|
+
["text", "hidden", "password", "textarea", "select-one", "select-multiple"].includes(element.type))) {
|
|
2654
2630
|
if (element.type === "select-multiple") {
|
|
2655
2631
|
for (let j = 0; j < element.options.length; j++) {
|
|
2656
2632
|
if (element.options[j].selected) {
|
|
@@ -2870,9 +2846,7 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
2870
2846
|
});
|
|
2871
2847
|
return;
|
|
2872
2848
|
}
|
|
2873
|
-
if (DOMUtilsContext.windowApi.globalThis
|
|
2874
|
-
.getComputedStyle(element)
|
|
2875
|
-
.getPropertyValue("display") === "none") {
|
|
2849
|
+
if (DOMUtilsContext.windowApi.globalThis.getComputedStyle(element).getPropertyValue("display") === "none") {
|
|
2876
2850
|
DOMUtilsContext.show(element, checkVisiblie);
|
|
2877
2851
|
}
|
|
2878
2852
|
else {
|
|
@@ -2917,9 +2891,7 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
2917
2891
|
selectionStart = Math.min($input.value.length, selectionStart);
|
|
2918
2892
|
if (typeof selectionEnd == "string")
|
|
2919
2893
|
selectionEnd = parseFloat(selectionEnd);
|
|
2920
|
-
if (typeof selectionEnd != "number" ||
|
|
2921
|
-
isNaN(selectionEnd) ||
|
|
2922
|
-
selectionEnd < selectionStart) {
|
|
2894
|
+
if (typeof selectionEnd != "number" || isNaN(selectionEnd) || selectionEnd < selectionStart) {
|
|
2923
2895
|
selectionEnd = selectionStart;
|
|
2924
2896
|
}
|
|
2925
2897
|
if (selectionEnd < 0)
|
|
@@ -3006,11 +2978,7 @@ System.register('DOMUtils', [], (function (exports) {
|
|
|
3006
2978
|
var isBoxModel = $box.offsetWidth == 2;
|
|
3007
2979
|
body.removeChild($box);
|
|
3008
2980
|
let $boxRect = $input.getBoundingClientRect();
|
|
3009
|
-
var clientTop = docElem.clientTop || body.clientTop || 0, clientLeft = docElem.clientLeft || body.clientLeft || 0, scrollTop = win.pageYOffset ||
|
|
3010
|
-
(isBoxModel && docElem.scrollTop) ||
|
|
3011
|
-
body.scrollTop, scrollLeft = win.pageXOffset ||
|
|
3012
|
-
(isBoxModel && docElem.scrollLeft) ||
|
|
3013
|
-
body.scrollLeft;
|
|
2981
|
+
var clientTop = docElem.clientTop || body.clientTop || 0, clientLeft = docElem.clientLeft || body.clientLeft || 0, scrollTop = win.pageYOffset || (isBoxModel && docElem.scrollTop) || body.scrollTop, scrollLeft = win.pageXOffset || (isBoxModel && docElem.scrollLeft) || body.scrollLeft;
|
|
3014
2982
|
return {
|
|
3015
2983
|
top: $boxRect.top + scrollTop - clientTop,
|
|
3016
2984
|
left: $boxRect.left + scrollLeft - clientLeft,
|