@codady/utils 0.0.19 → 0.0.20

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/utils.cjs.js CHANGED
@@ -1,8 +1,8 @@
1
1
 
2
2
  /*!
3
- * @since Last modified: 2026-1-5 10:34:3
3
+ * @since Last modified: 2026-1-5 10:51:1
4
4
  * @name Utils for web front-end.
5
- * @version 0.0.19
5
+ * @version 0.0.20
6
6
  * @author AXUI development team <3217728223@qq.com>
7
7
  * @description This is a set of general-purpose JavaScript utility functions developed by the AXUI team. All functions are pure and do not involve CSS or other third-party libraries. They are suitable for any web front-end environment.
8
8
  * @see {@link https://www.axui.cn|Official website}
@@ -1,7 +1,7 @@
1
1
  /*!
2
- * @since Last modified: 2026-1-5 10:34:3
2
+ * @since Last modified: 2026-1-5 10:51:1
3
3
  * @name Utils for web front-end.
4
- * @version 0.0.19
4
+ * @version 0.0.20
5
5
  * @author AXUI development team <3217728223@qq.com>
6
6
  * @description This is a set of general-purpose JavaScript utility functions developed by the AXUI team. All functions are pure and do not involve CSS or other third-party libraries. They are suitable for any web front-end environment.
7
7
  * @see {@link https://www.axui.cn|Official website}
package/dist/utils.esm.js CHANGED
@@ -1,8 +1,8 @@
1
1
 
2
2
  /*!
3
- * @since Last modified: 2026-1-5 10:34:3
3
+ * @since Last modified: 2026-1-5 10:51:1
4
4
  * @name Utils for web front-end.
5
- * @version 0.0.19
5
+ * @version 0.0.20
6
6
  * @author AXUI development team <3217728223@qq.com>
7
7
  * @description This is a set of general-purpose JavaScript utility functions developed by the AXUI team. All functions are pure and do not involve CSS or other third-party libraries. They are suitable for any web front-end environment.
8
8
  * @see {@link https://www.axui.cn|Official website}
@@ -1,7 +1,7 @@
1
1
  /*!
2
- * @since Last modified: 2026-1-5 10:34:3
2
+ * @since Last modified: 2026-1-5 10:51:1
3
3
  * @name Utils for web front-end.
4
- * @version 0.0.19
4
+ * @version 0.0.20
5
5
  * @author AXUI development team <3217728223@qq.com>
6
6
  * @description This is a set of general-purpose JavaScript utility functions developed by the AXUI team. All functions are pure and do not involve CSS or other third-party libraries. They are suitable for any web front-end environment.
7
7
  * @see {@link https://www.axui.cn|Official website}
package/dist/utils.umd.js CHANGED
@@ -1,8 +1,8 @@
1
1
 
2
2
  /*!
3
- * @since Last modified: 2026-1-5 10:34:3
3
+ * @since Last modified: 2026-1-5 10:51:1
4
4
  * @name Utils for web front-end.
5
- * @version 0.0.19
5
+ * @version 0.0.20
6
6
  * @author AXUI development team <3217728223@qq.com>
7
7
  * @description This is a set of general-purpose JavaScript utility functions developed by the AXUI team. All functions are pure and do not involve CSS or other third-party libraries. They are suitable for any web front-end environment.
8
8
  * @see {@link https://www.axui.cn|Official website}
@@ -1,7 +1,7 @@
1
1
  /*!
2
- * @since Last modified: 2026-1-5 10:34:3
2
+ * @since Last modified: 2026-1-5 10:51:1
3
3
  * @name Utils for web front-end.
4
- * @version 0.0.19
4
+ * @version 0.0.20
5
5
  * @author AXUI development team <3217728223@qq.com>
6
6
  * @description This is a set of general-purpose JavaScript utility functions developed by the AXUI team. All functions are pure and do not involve CSS or other third-party libraries. They are suitable for any web front-end environment.
7
7
  * @see {@link https://www.axui.cn|Official website}
package/dist.zip CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codady/utils",
3
- "version": "0.0.19",
3
+ "version": "0.0.20",
4
4
  "author": "AXUI Development Team",
5
5
  "license": "MIT",
6
6
  "description": "This is a set of general-purpose JavaScript utility functions developed by the AXUI team. All functions are pure and do not involve CSS or other third-party libraries. They are suitable for any web front-end environment.",
package/src/getEl.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @since Last modified: 2026/01/05 10:28:14
2
+ * @since Last modified: 2026/01/05 10:50:46
3
3
  * @function getEl
4
4
  * @description Get a DOM node (real or virtual). Supports obtaining nodes from various types (not just HTMLElement).
5
5
  * @param {string|Node} obj - Can be a node selector (e.g., #id, .classname, NODENAME, [attribute]) or any node type (HTMLElement, Node, DocumentFragment, etc.).
@@ -20,7 +20,7 @@ import getDataType from './getDataType';
20
20
  const getEl = (obj: string | Node | null, wrap: Node | string | null = document.body): Node | null => {
21
21
  let objType = getDataType(obj),
22
22
  parType = getDataType(wrap),
23
- parent = parType.includes('HTML') ? wrap : document.querySelector(wrap as string),
23
+ parent = parType.includes('HTML') || parType === 'ShadowRoot' ? wrap : document.querySelector(wrap as string),
24
24
  //如果parent是template节点,需要通过node.content.querySelector取得子节点
25
25
  root = parent && parent instanceof HTMLTemplateElement ? parent.content : parent,
26
26
  result: Node | null = null;