JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 18638017
  • Score
    100M100P100Q220027F
  • License MIT

Information for HTML properties

Package Exports

  • property-information

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (property-information) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

property-information Build Status Coverage Status

Information for HTML properties.

Installation

npm:

npm install property-information

property-information is also available for AMD, CommonJS, and globals (uncompressed and compressed).

Usage

console.log(propertyInformation('class'));

Yields:

{
  "name": "class",
  "propertyName": "className",
  "mustUseAttribute": true,
  "mustUseProperty": false,
  "boolean": false,
  "overloadedBoolean": false,
  "numeric": false,
  "positiveNumeric": false,
  "commaSeparated": false,
  "spaceSeparated": true
}

API

propertyInformation(name)

Get information for a DOM property.

Parameters:

  • name (string) — Case-insensitive name.

Returns: Information? — Information, when available.

propertyInformation.all

Object mapping case-insensitive names to Information objects. This gives raw access to the information returned by propertyInformation(): do not change the objects.

Information

Properties:

  • name (string) — Case-insensitive name;

  • propertyName (string) — Case-sensitive IDL attribute (e.g., a class attribute is added in HTML and a className is added in Web IDL);

  • mustUseAttribute (boolean) — Whether setAttribute must be used when patching a DOM node;

  • mustUseProperty (boolean) — Whether node[propertyName] must be used when patching a DOM node;

  • boolean (boolean) — Whether the value of the property is boolean;

  • overloadedBoolean (boolean) — Whether the value of the property can be boolean;

  • numeric (boolean) — Whether the value of the property is number;

  • positiveNumeric (boolean) — Whether the value of the property is number and positive;

  • spaceSeparated (boolean) — Whether the value of the property is a space-separated list;

  • commaSeparated (boolean) — Whether the value of the property is a comma-separated list.

Note that some values can be both *Separated and a primitive, in that case each of the tokens should be regarded as a primitive. For example, itemScope is both spaceSeparated and boolean:

{
  "name": "itemscope",
  "propertyName": "itemScope",
  "mustUseAttribute": true,
  "mustUseProperty": false,
  "boolean": true,
  "overloadedBoolean": false,
  "numeric": false,
  "positiveNumeric": false,
  "commaSeparated": false,
  "spaceSeparated": true
}

License

MIT © Titus Wormer

Derivative work based on React licensed under BSD-3-Clause-Clear, © 2013-2015, Facebook, Inc.