@asamuzakjp/dom-selector 0.19.1 → 0.19.2
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/README.md +3 -3
- package/package.json +2 -2
- package/src/js/matcher.js +1 -1
- package/types/index.d.ts +7 -6
- package/types/js/matcher.d.ts +6 -5
- package/types/js/parser.d.ts +2 -3
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
[](https://github.com/asamuzaK/domSelector/releases)
|
|
9
9
|
-->
|
|
10
10
|
|
|
11
|
-
Retrieve DOM node from the given CSS selector.
|
|
11
|
+
Retrieve DOM node from the given CSS selector.
|
|
12
12
|
**Experimental**
|
|
13
13
|
|
|
14
14
|
## Install
|
|
@@ -38,7 +38,7 @@ matches - same functionality as [Element.matches()][64]
|
|
|
38
38
|
- `opt` **[object][60]?** options
|
|
39
39
|
- `opt.warn` **[boolean][61]?** console warn e.g. unsupported pseudo-class
|
|
40
40
|
|
|
41
|
-
Returns **[boolean][61]** `true` if matched `false` otherwise
|
|
41
|
+
Returns **[boolean][61]** `true` if matched, `false` otherwise
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
### closest(selector, node, opt)
|
|
@@ -71,7 +71,7 @@ Returns **[object][60]?** matched node
|
|
|
71
71
|
|
|
72
72
|
### querySelectorAll(selector, refPoint, opt)
|
|
73
73
|
|
|
74
|
-
querySelectorAll - same functionality as [Document.querySelectorAll()][69], [DocumentFragment.querySelectorAll()][70], [Element.querySelectorAll()][71]
|
|
74
|
+
querySelectorAll - same functionality as [Document.querySelectorAll()][69], [DocumentFragment.querySelectorAll()][70], [Element.querySelectorAll()][71]
|
|
75
75
|
**NOTE**: returns Array, not NodeList
|
|
76
76
|
|
|
77
77
|
#### Parameters
|
package/package.json
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"chai": "^4.3.7",
|
|
30
30
|
"eslint": "^8.43.0",
|
|
31
31
|
"eslint-config-standard": "^17.1.0",
|
|
32
|
-
"eslint-plugin-jsdoc": "^46.
|
|
32
|
+
"eslint-plugin-jsdoc": "^46.3.0",
|
|
33
33
|
"eslint-plugin-regexp": "^1.15.0",
|
|
34
34
|
"eslint-plugin-unicorn": "^47.0.0",
|
|
35
35
|
"jsdom": "^22.1.0",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"test": "c8 --reporter=text mocha --exit test/**/*.test.js",
|
|
47
47
|
"tsc": "npx tsc"
|
|
48
48
|
},
|
|
49
|
-
"version": "0.19.
|
|
49
|
+
"version": "0.19.2"
|
|
50
50
|
}
|
package/src/js/matcher.js
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
export function closest(selector: string, node: object, opt?: {
|
|
2
|
-
warn?: object;
|
|
3
|
-
}): object | null;
|
|
4
1
|
export function matches(selector: string, node: object, opt?: {
|
|
5
|
-
warn?:
|
|
2
|
+
warn?: boolean;
|
|
6
3
|
}): boolean;
|
|
4
|
+
export function closest(selector: string, node: object, opt?: {
|
|
5
|
+
warn?: boolean;
|
|
6
|
+
}): object | null;
|
|
7
7
|
export function querySelector(selector: string, refPoint: object, opt?: {
|
|
8
|
-
warn?:
|
|
8
|
+
warn?: boolean;
|
|
9
9
|
}): object | null;
|
|
10
10
|
export function querySelectorAll(selector: string, refPoint: object, opt?: {
|
|
11
|
-
|
|
11
|
+
sort?: boolean;
|
|
12
|
+
warn?: boolean;
|
|
12
13
|
}): Array<object | undefined>;
|
package/types/js/matcher.d.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
export function isContentEditable(node?: object): boolean;
|
|
2
|
+
export function isNamespaceDeclared(ns?: string, node?: object): boolean;
|
|
3
|
+
export function isDescendant(node?: object, root?: object): boolean;
|
|
4
|
+
export function unescapeSelector(selector?: string): string | null;
|
|
5
|
+
export function parseASTName(name: string, node?: object): object;
|
|
1
6
|
export class Matcher {
|
|
2
7
|
constructor(selector: string, node: object, opt?: {
|
|
8
|
+
sort?: boolean;
|
|
3
9
|
warn?: boolean;
|
|
4
10
|
});
|
|
5
11
|
_onError(e: Error): void;
|
|
@@ -44,8 +50,3 @@ export class Matcher {
|
|
|
44
50
|
querySelectorAll(): Array<object | undefined>;
|
|
45
51
|
#private;
|
|
46
52
|
}
|
|
47
|
-
export function isContentEditable(node?: object): boolean;
|
|
48
|
-
export function isDescendant(node?: object, root?: object): boolean;
|
|
49
|
-
export function isNamespaceDeclared(ns?: string, node?: object): boolean;
|
|
50
|
-
export function parseASTName(name: string, node?: object): object;
|
|
51
|
-
export function unescapeSelector(selector?: string): string | null;
|
package/types/js/parser.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { generate } from "css-tree";
|
|
2
|
-
export function parseSelector(selector: string): object;
|
|
3
1
|
export function preprocess(...args: any[]): string;
|
|
2
|
+
export function parseSelector(selector: string): object;
|
|
4
3
|
export function walkAST(ast?: object): Array<object | undefined>;
|
|
5
|
-
export { generate as generateCSS };
|
|
4
|
+
export { generate as generateCSS } from "css-tree";
|