inlineSvg関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
The flag's SVG made to fill the span that holds it, and hidden from a screen reader (the span carries the name): what the web bindings put inside the span as HTML.
インポート
import { inlineSvg } from "@johnmorrisdotca/hata/bind";
定義
function inlineSvg(svg: string): string
引数
| 名前 | 型 | 説明 |
|---|---|---|
svg | string | A flag's SVG string ( |
戻り値
string
The SVG with a style that fills its box, aria-hidden and focusable="false".
例
import { inlineSvg } from "@johnmorrisdotca/hata/bind";
console.log(inlineSvg("<svg viewBox=\"0 0 3 2\"></svg>")); // <svg style="display:block;width:100%;height:100%" aria-hidden="true" focusable="false" viewBox="0 0 3 2"></svg><svg style="display:block;width:100%;height:100%" aria-hidden="true" focusable="false" viewBox="0 0 3 2"></svg>出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。