Skip to content

关于chrome中的$ #4

@lvleihere

Description

@lvleihere

chrome中有很多的方便的快捷键,这记录下 $ 的使用

  • 纯$
    选中一个DOM节点,然后控制台输入,$0 你就能取到该节点,但前提是当前环境是纯净的~
    例如我选中了一个title节点:
$0 === document.querySelector('title')  // true

image

对应的 $1 取的是其直接的父级元素

$1 === document.body  // true

image

如果说 $document.querySelector 的简写,该方法选择的是某个具体单一的元素,那么对应的 $$ 则是 document.querySelectotAll 外加 Array.from() 的简写

  • $_
    使用该方法能够获取到上次控制台打印的信息
    image

  • $i
    该方法需要安装google插件 Console Importer ,用气使用npm包很方便的下载调试。
    image

====end====

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions