Options
All
  • Public
  • Public/Protected
  • All
Menu

selector

単純な querySelector のエイリアス

インストール

npm install @maboroshi/selector

or

yarn add @maboroshi/selector

使い方

import { $, $$ } from '@maboroshi/selector'

console.log($('p')) // => The 1st P element on the document.
console.log($$('p')) // => The All P elements on the document.

API

API ドキュメント を見る

Index

Type aliases

Functions

Type aliases

MatchedElement

MatchedElement<T, E>: T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T] : T extends keyof SVGElementTagNameMap ? SVGElementTagNameMap[T] : E

適合要素型

Type parameters

Selector

Selector: keyof HTMLElementTagNameMap | keyof SVGElementTagNameMap | string

セレクター型

Functions

$

  • セレクターにマッチする最初の要素を返す

    Type parameters

    Parameters

    • selector: T

      セレクター文字列

    • Default value ctx: ParentNode = document

      コンテキスト要素

    Returns MatchedElement<T, E> | null

    ctx から selector にマッチする最初の要素を返す

$$

  • $$<E, T>(selector: T, ctx?: ParentNode): NodeListOf<MatchedElement<T, E>>
  • セレクターにマッチする全ての要素を返す

    Type parameters

    Parameters

    • selector: T

      セレクター文字列

    • Default value ctx: ParentNode = document

      コンテキスト要素

    Returns NodeListOf<MatchedElement<T, E>>

    ctx から selector にマッチする全ての要素を返す

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc