# property-information
[![Build][build-badge]][build]
[![Coverage][coverage-badge]][coverage]
[![Downloads][downloads-badge]][downloads]
[![Size][size-badge]][size]
Info for properties and attributes on the web-platform (HTML, SVG, ARIA, XML,
XMLNS, XLink).
This package follows a sensible naming scheme as defined by [hast][].
## Install
[npm][]:
```sh
npm install property-information
```
## Contents
* [Use](#use)
* [API](#api)
* [`propertyInformation.find(schema, name)`](#propertyinformationfindschema-name)
* [`propertyInformation.normalize(name)`](#propertyinformationnormalizename)
* [`propertyInformation.html`](#propertyinformationhtml)
* [`propertyInformation.svg`](#propertyinformationsvg)
* [`hastToReact`](#hasttoreact)
* [Support](#support)
* [Related](#related)
* [License](#license)
## Use
```js
var info = require('property-information')
console.log(info.find(info.html, 'className'))
// Or: info.find(info.html, 'class')
console.log(info.find(info.svg, 'horiz-adv-x'))
// Or: info.find(info.svg, 'horizAdvX')
console.log(info.find(info.svg, 'xlink:arcrole'))
// Or: info.find(info.svg, 'xLinkArcRole')
console.log(info.find(info.html, 'xmlLang'))
// Or: info.find(info.html, 'xml:lang')
console.log(info.find(info.html, 'ariaValueNow'))
// Or: info.find(info.html, 'aria-valuenow')
```
Yields:
```js
{ space: 'html',
attribute: 'class',
property: 'className',
spaceSeparated: true }
{ space: 'svg',
attribute: 'horiz-adv-x',
property: 'horizAdvX',
number: true }
{ space: 'xlink', attribute: 'xlink:arcrole', property: 'xLinkArcrole' }
{ space: 'xml', attribute: 'xml:lang', property: 'xmlLang' }
{ attribute: 'aria-valuenow', property: 'ariaValueNow', number: true }
```
## API
### `propertyInformation.find(schema, name)`
Look up info on a property.
In most cases, the given `schema` contains info on the property.
All standard, most legacy, and some non-standard properties are supported.
For these cases, the returned [`Info`][info] has hints about value of the
property.
`name` can be a [valid data attribute or property][data], in which case an
[`Info`][info] object with the correctly cased `attribute` and `property` is
returned.
`name` can be an unknown attribute, in which case an [`Info`][info] object
with `attribute` and `property` set to the given name is returned.
It is not recommended to provide unsupported legacy or recently specced
properties.
#### Parameters
* `schema` ([`Schema`][schema])
— Either `propertyInformation.html` or `propertyInformation.svg`
* `name` (`string`)
— An attribute-like or property-like name that is passed through
[`normalize`][normalize] to find the correct info
#### Returns
[`Info`][info].
#### Note
`find` can be accessed directly from `require('property-information/find')` as
well.
#### Example
Aside from the aforementioned example, which shows known HTML, SVG, XML, XLink,
and ARIA support, data properties, and attributes are also supported:
```js
console.log(info.find(info.html, 'data-date-of-birth'))
// Or: info.find(info.html, 'dataDateOfBirth')
```
Yields:
```js
{ attribute: 'data-date-of-birth', property: 'dataDateOfBirth' }
```
Unknown values are passed through untouched:
```js
console.log(info.find(info.html, 'un-Known'))
```
Yields:
```js
{ attribute: 'un-Known', property: 'un-Known' }
```
### `propertyInformation.normalize(name)`
Get the cleaned case-insensitive form of an attribute or a property.
#### Parameters
* `name` (`string`) — An attribute-like or property-like name
#### Returns
`string` that can be used to look up the properly cased property in a
[`Schema`][schema].
#### Note
`normalize` can be accessed directly from
`require('property-information/normalize')` as well.
#### Example
```js
info.html.normal[info.normalize('for')] // => 'htmlFor'
info.svg.normal[info.normalize('VIEWBOX')] // => 'viewBox'
info.html.normal[info.normalize('unknown')] // => undefined
info.html.normal[info.normalize('accept-charset')] // => 'acceptCharset'
```
### `propertyInformation.html`
### `propertyInformation.svg`
[`Schema`][schema] for either HTML or SVG, containing info on properties from
the primary space (HTML or SVG) and related embedded spaces (ARIA, XML, XMLNS,
XLink).
#### Note
`html` and `svg` can be accessed directly from
`require('property-information/html')` and `require('property-information/svg')`
as well.
#### Example
```js
console.log(info.html.property.htmlFor)
console.log(info.svg.property.viewBox)
console.log(info.html.property.unknown)
```
Yields:
```js
{ space: 'html',
attribute: 'for',
property: 'htmlFor',
spaceSeparated: true }
{ space: 'svg', attribute: 'viewBox', property: 'viewBox' }
undefined
```
#### `Schema`
A schema for a primary space.
* `space` (`'html'` or `'svg'`) — Primary space of the schema
* `normal` (`Object.<string>`) — Object mapping normalized attributes and
properties to properly cased properties
* `property` ([`Object.<Info>`][info]) — Object mapping properties to info
#### `Info`
Info on a property.
* `space` (`'html'`, `'svg'`, `'xml'`, `'xlink'`, `'xmlns'`, optional)
— [Space][namespace] of the property
* `attribute` (`string`) — Attribute name for the property that could be used
in markup (for example: `'aria-describedby'`, `'allowfullscreen'`,
`'xml:lang'`, `'for'`, or `'charoff'`)
* `property` (`string`) — JavaScript-style camel-cased name, based on the
DOM, but sometimes different (for example: `'ariaDescribedBy'`,
`'allowFullScreen'`, `'xmlLang'`, `'htmlFor'`, `'charOff'`)
* `boolean` (`boolean`) — The property is `boolean`.
The default value of this property is false, so it can be omitted
* `booleanish` (`boolean`) — The property is a `boolean`.
The default value of this property is something other than false, so
`false` must persist.
The value can hold a string (as is the case with `ariaChecked` and its
`'mixed'` value)
* `overloadedBoolean` (`boolean`) — The property is `boolean`.
The default value of this property is false, so it can be omitted.
The value can hold a string (as is the case with `download` as its value
reflects the name to use for the downloaded file)
* `number` (`boolean`) — The property is `number`.
These values can sometimes hold a string
* `spaceSeparated` (`boolean`) — The property is a list separated by spaces
(for example, `className`)
* `commaSeparated` (`boolean`) — The property is a list separated by commas
(for example, `srcSet`)
* `commaOrSpaceSeparated` (`boolean`) — The property is a list separated by
commas or spaces (for example, `strokeDashArray`)
* `mustUseProperty` (`boolean`) — If a DOM is used, setting the property
should be used for the change to take effect (this is true only for
`'checked'`, `'multiple'`, `'muted'`, and `'selected'`)
* `defined` (`boolean`) — The property is [defined by a space](#support).
This is true for values in HTML (including data and ARIA), SVG, XML,
XMLNS, and XLink.
These values can only be accessed through `find`.
### `hastToReact`
> Accessible through `require('property-information/hast-to-react.json')`
[hast][] is close to [React][], but differs in a couple of cases.
To get a React property from a hast property, check if it is in
[`hast-to-react`][hast-to-react] (`Object.<string>`), if it is, then use the
corresponding value, otherwise, use the hast property.
## Support
<!--list start-->
| Property | Attribute | Space |
| ---------------------------- | ------------------------------ | ------------- |
| `aLink` | `alink` | `html` |
| `abbr` | `abbr` | `html` |
| `about` | `about` | `svg` |
| `accentHeight`
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
【项目资源】: 包含前端、后端、移动开发、操作系统、人工智能、物联网、信息化管理、数据库、硬件开发、大数据、课程资源、音视频、网站开发等各种技术项目的源码。 包括STM32、ESP8266、PHP、QT、Linux、iOS、C++、Java、python、web、C#、EDA、proteus、RTOS等项目的源码。 【项目质量】: 所有源码都经过严格测试,可以直接运行。 功能在确认正常工作后才上传。 【适用人群】: 适用于希望学习不同技术领域的小白或进阶学习者。 可作为毕设项目、课程设计、大作业、工程实训或初期项目立项。 【附加价值】: 项目具有较高的学习借鉴价值,也可直接拿来修改复刻。 对于有一定基础或热衷于研究的人来说,可以在这些基础代码上进行修改和扩展,实现其他功能。 【沟通交流】: 有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。 鼓励下载和使用,并欢迎大家互相学习,共同进步。
资源推荐
资源详情
资源评论
收起资源包目录
毕设&课设&项目&实训-数据库课程设计-电子衣橱.zip (2001个子文件)
katex.css 26KB
katex.min.css 23KB
prism-treeview.css 8KB
prism-treeview.min.css 7KB
prism-previewers.css 5KB
prism-previewers.min.css 4KB
prism-coy.css 4KB
prism-twilight.css 4KB
nord.css 3KB
night-owl.css 3KB
prism-coy.min.css 3KB
prism-solarizedlight.css 3KB
prism-funky.css 2KB
prism-twilight.min.css 2KB
prism.css 2KB
purebasic.css 2KB
prism-dark.css 2KB
prism-funky.min.css 2KB
grayscale.css 2KB
prism-okaidia.css 2KB
prism.min.css 2KB
prism-tomorrow.css 2KB
prism-solarizedlight.min.css 2KB
prism-toolbar.css 2KB
prism-line-highlight.css 2KB
atom-one-dark-reasonable.css 2KB
prism-dark.min.css 1KB
a11y-light.css 1KB
a11y-dark.css 1KB
gruvbox-light.css 1KB
gruvbox-dark.css 1KB
vs2015.css 1KB
prism-okaidia.min.css 1KB
isbl-editor-dark.css 1KB
shades-of-purple.css 1KB
isbl-editor-light.css 1KB
nnfx-dark.css 1KB
nnfx.css 1KB
hybrid.css 1KB
gradient-light.css 1KB
prism-tomorrow.min.css 1KB
atelier-estuary-light.css 1KB
atelier-savanna-light.css 1KB
atelier-plateau-light.css 1KB
atelier-savanna-dark.css 1KB
atelier-estuary-dark.css 1KB
atelier-plateau-dark.css 1KB
atelier-cave-light.css 1KB
agate.css 1KB
gradient-dark.css 1KB
atelier-cave-dark.css 1KB
atom-one-light.css 1KB
atom-one-dark.css 1KB
routeros.css 1KB
xcode.css 1KB
railscasts.css 1KB
prism-toolbar.min.css 1KB
an-old-hope.css 1KB
sunburst.css 1KB
idea.css 1KB
default.css 1KB
tomorrow-night-blue.css 1KB
atelier-sulphurpool-light.css 1KB
atelier-sulphurpool-dark.css 1KB
tomorrow-night.css 1KB
github.css 1KB
solarized-light.css 1KB
solarized-dark.css 1KB
docco.css 1KB
prism-line-highlight.min.css 1KB
atelier-lakeside-light.css 1KB
atelier-lakeside-dark.css 1KB
pojoaque.css 1KB
atelier-seaside-light.css 1KB
atelier-seaside-dark.css 1KB
atelier-forest-light.css 1KB
atelier-forest-dark.css 1KB
atelier-heath-light.css 1KB
atelier-heath-dark.css 1KB
atelier-dune-light.css 1KB
atelier-dune-dark.css 1KB
foundation.css 1KB
tomorrow-night-eighties.css 1KB
tomorrow-night-bright.css 1KB
obsidian.css 1KB
hopscotch.css 1KB
kimbie.light.css 1KB
kimbie.dark.css 1KB
lightfair.css 1KB
prism-inline-color.css 1KB
lioshi.css 1KB
googlecode.css 1KB
xt256.css 1KB
github-gist.css 1KB
arduino-light.css 1KB
srcery.css 1KB
monokai-sublime.css 1KB
dracula.css 1016B
paraiso-light.css 1015B
paraiso-dark.css 1014B
共 2001 条
- 1
- 2
- 3
- 4
- 5
- 6
- 21
资源评论
- 2201_754751032024-10-21这个资源值得下载,资源内容详细全面,与描述一致,受益匪浅。
妄北y
- 粉丝: 2w+
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于Kotlin语言的Android开发工具类集合源码
- 零延迟 DirectX 11 扩展实用程序.zip
- 基于Java的语音识别系统设计源码
- 基于Java和HTML的yang_home766个人主页设计源码
- 基于Java与前端技术的全国实时疫情信息网站设计源码
- 基于鸿蒙系统的HarmonyHttpClient设计源码,纯Java实现类似OkHttp的HttpNet框架与优雅的Retrofit注解解析
- 基于HTML和JavaScript的廖振宇图书馆前端设计源码
- 基于Java的Android开发工具集合源码
- 通过 DirectX 12 Hook (kiero) 实现通用 ImGui.zip
- 基于Java开发的YY网盘个人网盘设计源码
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功