Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

utility to check if a node is an embedded element

License

NotificationsYou must be signed in to change notification settings

syntax-tree/hast-util-embedded

BuildCoverageDownloadsSizeSponsorsBackersChat

hast utility to check if a node isembedded content.

Contents

What is this?

This package is a small utility that checks if a node is embedded contentaccording to HTML.

When should I use this?

This utility is super niche, if you’re here you probably know what you’relooking for!

Install

This package isESM only.In Node.js (version 16+), install withnpm:

npm install hast-util-embedded

In Deno withesm.sh:

import{embedded}from'https://esm.sh/hast-util-embedded@3'

In browsers withesm.sh:

<scripttype="module">import{embedded}from'https://esm.sh/hast-util-embedded@3?bundle'</script>

Use

import{embedded}from'hast-util-embedded'// Given a non-embedded value:embedded({type:'element',tagName:'a',properties:{href:'#alpha',title:'Bravo'},children:[{type:'text',value:'Charlie'}]})// => false// Given a embedded element:embedded({type:'element',tagName:'audio',properties:{src:'delta.ogg'},children:[]})// => true

API

This package exports the identifierembedded.There is no default export.

embedded(value)

Check ifnode is anembedded content.

Parameters
  • value (unknown)— thing to check (typicallyNode)
Returns

Whethervalue is an element considered embedded content (boolean).

The elementsaudio,canvas,embed,iframe,img,math,object,picture,svg, andvideo are embedded content.

Types

This package is fully typed withTypeScript.It exports no additional types.

Compatibility

Projects maintained by the unified collective are compatible with maintainedversions of Node.js.

When we cut a new major release, we drop support for unmaintained versions ofNode.This means we try to keep the current release line,hast-util-embedded@^3,compatible with Node.js 16.

Security

hast-util-embedded does not change the syntax tree so there are no openingsforcross-site scripting (XSS) attacks.

Related

Contribute

Seecontributing.md insyntax-tree/.github forways to get started.Seesupport.md for ways to get help.

This project has acode of conduct.By interacting with this repository, organization, or community you agree toabide by its terms.

License

MIT ©Titus Wormer

About

utility to check if a node is an embedded element

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Contributors3

  •  
  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp