Initial commit
This commit is contained in:
38
commands/browser-eval.md
Normal file
38
commands/browser-eval.md
Normal file
@@ -0,0 +1,38 @@
|
||||
---
|
||||
description: Execute JavaScript in the browser's page context. Great for inspecting DOM, computed styles, or testing fixes.
|
||||
allowed-tools: Bash(*)
|
||||
argument-hint: <javascript expression>
|
||||
model: haiku
|
||||
---
|
||||
|
||||
# Evaluate JavaScript
|
||||
|
||||
Execute JavaScript in the active browser tab's page context.
|
||||
|
||||
```bash
|
||||
node ~/.claude/plugins/*/skills/website-debug/scripts/browser-eval.js '$ARGUMENTS'
|
||||
```
|
||||
|
||||
## Common Uses
|
||||
|
||||
**Get element info:**
|
||||
```
|
||||
document.querySelector(".selector")
|
||||
```
|
||||
|
||||
**Check computed styles:**
|
||||
```
|
||||
getComputedStyle(document.querySelector(".btn")).backgroundColor
|
||||
```
|
||||
|
||||
**Count elements:**
|
||||
```
|
||||
document.querySelectorAll("a").length
|
||||
```
|
||||
|
||||
**Get bounding rect:**
|
||||
```
|
||||
document.querySelector(".header").getBoundingClientRect()
|
||||
```
|
||||
|
||||
Return the result to the user and explain what it means in context.
|
||||
Reference in New Issue
Block a user