blob: 1667d4d35014236085c4ee127454ab8032dc43ec (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
import { adopt } from '../../utils/adopter.js'
import { globals } from '../../utils/window.js'
import { map } from '../../utils/utils.js'
import List from '../../types/List.js'
export default function baseFind (query, parent) {
return new List(map((parent || globals.document).querySelectorAll(query), function (node) {
return adopt(node)
}))
}
// Scoped find method
export function find (query) {
return baseFind(query, this.node)
}
export function findOne (query) {
return adopt(this.node.querySelector(query))
}
|