Chrome console & Command Line API `$` && `$$` querySelector querySelectorAll
$
&& $$
querySelector
querySelectorAll
Command Line API
"use strict";
/**
*
* @author xgqfrms
* @license MIT
* @copyright xgqfrms
* @created 2020-10-01
* @modified
*
* @description Chrome & Command Line API
* @difficulty Easy Medium Hard
* @complexity O(n)
* @augments
* @example
* @link
* @solutions
*
* @best_solutions
*
*/
const log = console.log;
/*
typeof $$(`*`);
// "object"
Array.isArray($$(`*`));
// true
*/
const items = [...$$(`*`)];
for(const item of items) {
log(`item =`, item);
// append styles ✅
const styles = item.getAttribute(`style`)
item.setAttribute(`style`, `color: green !important;` + styles);
item.setAttribute(`style`, `color: green !important; ${styles}`);
}
for(const item of items) {
log(`item =`, item);
item.setAttribute(`style`, `border: green px solid red !important;`);
// writeable & css overwrite bug ❌
item.setAttribute(`style`, `color: green !important;`);
}
for(const item of items) {
log(`item =`, item);
// writeable & css overwrite bug ❌
item.style = "border: 1px solid red !important";
}
for(const item of items) {
log(`item =`, item);
// read only bug ❌ ????
item.style.border = "1px solid red !important";
}
refs
使用 Canvas 实现一个类似 Google 的可视化的页面错误反馈库
xgqfrms