ref: dumb it down, full Ai ahead!
This commit is contained in:
parent
607f69e402
commit
dc70e6caab
11
ajquery.js
11
ajquery.js
|
@ -1,7 +1,10 @@
|
|||
function $(sel, $parent = document) {
|
||||
return $parent.querySelector(sel);
|
||||
function $(cssSelector, $parent = document) {
|
||||
let $child = $parent.querySelector(cssSelector);
|
||||
return $child;
|
||||
}
|
||||
|
||||
function $$(sel, $parent = document) {
|
||||
return Array.from($parent.querySelectorAll(sel));
|
||||
function $$(cssSelector, $parent = document) {
|
||||
let nodeList = $parent.querySelectorAll(cssSelector);
|
||||
let $children = Array.from(nodeList);
|
||||
return $children;
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
<script src="./ajquery.js"></script>
|
||||
<script>
|
||||
document.write("Hello, World!");
|
||||
console.log($("body").textContent));
|
||||
let text = $("body").textContent;
|
||||
console.log(text);
|
||||
</script>
|
||||
</body>
|
||||
|
|
Loading…
Reference in New Issue