property-information
Advanced tools
Comparing version 1.0.0 to 2.0.0
@@ -5,3 +5,9 @@ <!--mdast setext--> | ||
2.0.0 / 2015-09-26 | ||
================== | ||
* Add new property information, new properties ([e3aa72b](https://github.com/wooorm/property-information/commit/e3aa72b)) | ||
* Add support for look-up by attribute name ([37f1955](https://github.com/wooorm/property-information/commit/37f1955)) | ||
1.0.0 / 2015-09-20 | ||
================== |
105
index.js
@@ -24,2 +24,4 @@ /** | ||
var OVERLOADED_BOOLEAN_VALUE = 0x40; | ||
var SPACE_SEPARATED = 0x80; | ||
var COMMA_SEPARATED = 0x100; | ||
@@ -51,5 +53,6 @@ /** | ||
*/ | ||
'accept': null, | ||
'acceptCharset': null, | ||
'accessKey': null, | ||
'abbr': null, | ||
'accept': COMMA_SEPARATED, | ||
'acceptCharset': SPACE_SEPARATED, | ||
'accessKey': SPACE_SEPARATED, | ||
'action': null, | ||
@@ -60,3 +63,3 @@ 'allowFullScreen': USE_ATTRIBUTE | BOOLEAN_VALUE, | ||
'async': BOOLEAN_VALUE, | ||
'autoComplete': null, | ||
'autoComplete': SPACE_SEPARATED, | ||
'autoFocus': BOOLEAN_VALUE, | ||
@@ -67,12 +70,13 @@ 'autoPlay': BOOLEAN_VALUE, | ||
'cellSpacing': null, | ||
'challenge': USE_ATTRIBUTE, | ||
'charSet': USE_ATTRIBUTE, | ||
'challenge': USE_ATTRIBUTE, | ||
'checked': USE_PROPERTY | BOOLEAN_VALUE, | ||
'classID': USE_ATTRIBUTE, | ||
'cite': null, | ||
/* To set className on SVG elements, it's necessary to | ||
* use .setAttribute; this works on HTML elements too | ||
* in all browsers except IE8. */ | ||
'className': USE_ATTRIBUTE, | ||
'className': USE_ATTRIBUTE | SPACE_SEPARATED, | ||
'cols': USE_ATTRIBUTE | POSITIVE_NUMERIC_VALUE, | ||
'colSpan': null, | ||
'command': null, | ||
'content': null, | ||
@@ -82,3 +86,3 @@ 'contentEditable': null, | ||
'controls': USE_PROPERTY | BOOLEAN_VALUE, | ||
'coords': null, | ||
'coords': NUMERIC_VALUE | COMMA_SEPARATED, | ||
'crossOrigin': null, | ||
@@ -88,7 +92,10 @@ /* For `<object />` acts as `src`. */ | ||
'dateTime': USE_ATTRIBUTE, | ||
'default': BOOLEAN_VALUE, | ||
'defer': BOOLEAN_VALUE, | ||
'dir': null, | ||
'dirName': null, | ||
'disabled': USE_ATTRIBUTE | BOOLEAN_VALUE, | ||
'download': OVERLOADED_BOOLEAN_VALUE, | ||
'draggable': null, | ||
'dropzone': SPACE_SEPARATED, | ||
'encType': null, | ||
@@ -102,14 +109,16 @@ 'form': USE_ATTRIBUTE, | ||
'frameBorder': USE_ATTRIBUTE, | ||
'headers': null, | ||
'height': USE_ATTRIBUTE, | ||
'headers': SPACE_SEPARATED, | ||
'height': USE_ATTRIBUTE | POSITIVE_NUMERIC_VALUE, | ||
'hidden': USE_ATTRIBUTE | BOOLEAN_VALUE, | ||
'high': null, | ||
'high': NUMERIC_VALUE, | ||
'href': null, | ||
'hrefLang': null, | ||
'htmlFor': null, | ||
'httpEquiv': null, | ||
'htmlFor': SPACE_SEPARATED, | ||
'httpEquiv': SPACE_SEPARATED, | ||
'icon': null, | ||
'id': USE_PROPERTY, | ||
'inputMode': USE_ATTRIBUTE, | ||
/* Web Components */ | ||
'is': USE_ATTRIBUTE, | ||
'isMap': BOOLEAN_VALUE, | ||
'keyParams': USE_ATTRIBUTE, | ||
@@ -121,20 +130,23 @@ 'keyType': USE_ATTRIBUTE, | ||
'loop': USE_PROPERTY | BOOLEAN_VALUE, | ||
'low': null, | ||
'low': NUMERIC_VALUE, | ||
'manifest': USE_ATTRIBUTE, | ||
'marginHeight': null, | ||
'marginWidth': null, | ||
'marginHeight': NUMERIC_VALUE, | ||
'marginWidth': NUMERIC_VALUE, | ||
'max': null, | ||
'maxLength': USE_ATTRIBUTE, | ||
'maxLength': USE_ATTRIBUTE | POSITIVE_NUMERIC_VALUE, | ||
'media': USE_ATTRIBUTE, | ||
'mediaGroup': null, | ||
'menu': null, | ||
'method': null, | ||
'min': null, | ||
'minLength': USE_ATTRIBUTE, | ||
'minLength': USE_ATTRIBUTE | POSITIVE_NUMERIC_VALUE, | ||
'multiple': USE_PROPERTY | BOOLEAN_VALUE, | ||
'muted': USE_PROPERTY | BOOLEAN_VALUE, | ||
'name': null, | ||
'nonce': null, | ||
'noValidate': BOOLEAN_VALUE, | ||
'open': BOOLEAN_VALUE, | ||
'optimum': null, | ||
'optimum': NUMERIC_VALUE, | ||
'pattern': null, | ||
'ping': SPACE_SEPARATED, | ||
'placeholder': null, | ||
@@ -145,8 +157,9 @@ 'poster': null, | ||
'readOnly': USE_PROPERTY | BOOLEAN_VALUE, | ||
'rel': null, | ||
'rel': SPACE_SEPARATED, | ||
'required': BOOLEAN_VALUE, | ||
'reversed': BOOLEAN_VALUE, | ||
'role': USE_ATTRIBUTE, | ||
'rows': USE_ATTRIBUTE | POSITIVE_NUMERIC_VALUE, | ||
'rowSpan': null, | ||
'sandbox': null, | ||
'rowSpan': POSITIVE_NUMERIC_VALUE, | ||
'sandbox': SPACE_SEPARATED, | ||
'scope': null, | ||
@@ -159,3 +172,5 @@ 'scoped': BOOLEAN_VALUE, | ||
'size': USE_ATTRIBUTE | POSITIVE_NUMERIC_VALUE, | ||
'sizes': USE_ATTRIBUTE, | ||
'sizes': USE_ATTRIBUTE | SPACE_SEPARATED, | ||
'sortable': BOOLEAN_VALUE, | ||
'sorted': SPACE_SEPARATED, | ||
'span': POSITIVE_NUMERIC_VALUE, | ||
@@ -165,3 +180,4 @@ 'spellCheck': null, | ||
'srcDoc': USE_PROPERTY, | ||
'srcSet': USE_ATTRIBUTE, | ||
'srcLang': null, | ||
'srcSet': USE_ATTRIBUTE | COMMA_SEPARATED, | ||
'start': NUMERIC_VALUE, | ||
@@ -171,9 +187,11 @@ 'step': null, | ||
'summary': null, | ||
'tabIndex': null, | ||
'tabIndex': NUMERIC_VALUE, | ||
'target': null, | ||
'title': null, | ||
'translate': null, | ||
'type': null, | ||
'typeMustMatch': BOOLEAN_VALUE, | ||
'useMap': null, | ||
'value': USE_PROPERTY, | ||
'width': USE_ATTRIBUTE, | ||
'width': USE_ATTRIBUTE | NUMERIC_VALUE, | ||
'wmode': USE_ATTRIBUTE, | ||
@@ -187,3 +205,3 @@ 'wrap': null, | ||
/* autoCapitalize and autoCorrect are supported in | ||
* Mobile Safari forkeyboard hints. */ | ||
* Mobile Safari for keyboard hints. */ | ||
'autoCapitalize': null, | ||
@@ -196,5 +214,5 @@ 'autoCorrect': null, | ||
* support. See http://schema.org/docs/gs.html */ | ||
'itemProp': USE_ATTRIBUTE, | ||
'itemScope': USE_ATTRIBUTE | BOOLEAN_VALUE, | ||
'itemType': USE_ATTRIBUTE, | ||
'itemProp': USE_ATTRIBUTE | SPACE_SEPARATED, | ||
'itemScope': USE_ATTRIBUTE | BOOLEAN_VALUE | SPACE_SEPARATED, | ||
'itemType': USE_ATTRIBUTE | SPACE_SEPARATED, | ||
/* itemID and itemRef are for Microdata support as well | ||
@@ -206,3 +224,3 @@ * but only specified in the the WHATWG spec document. | ||
'itemID': USE_ATTRIBUTE, | ||
'itemRef': USE_ATTRIBUTE, | ||
'itemRef': USE_ATTRIBUTE | SPACE_SEPARATED, | ||
/* property is supported for OpenGraph in meta tags. */ | ||
@@ -226,6 +244,6 @@ 'property': null, | ||
var propertyToAttributeMapping = { | ||
'className': 'class', | ||
'htmlFor': 'for', | ||
'httpEquiv': 'http-equiv', | ||
'acceptCharset': 'accept-charset' | ||
'classname': 'class', | ||
'htmlfor': 'for', | ||
'httpequiv': 'http-equiv', | ||
'acceptcharset': 'accept-charset' | ||
}; | ||
@@ -237,3 +255,3 @@ | ||
var propertyInformationByAttributeName = {}; | ||
var information = {}; | ||
var property; | ||
@@ -244,6 +262,7 @@ var name; | ||
for (property in propertyConfig) { | ||
name = propertyToAttributeMapping[property] || lower(property); | ||
name = lower(property); | ||
name = propertyToAttributeMapping[name] || name; | ||
config = propertyConfig[property]; | ||
propertyInformationByAttributeName[name] = { | ||
information[name] = { | ||
'name': name, | ||
@@ -256,3 +275,5 @@ 'propertyName': property, | ||
'numeric': check(config, NUMERIC_VALUE), | ||
'positiveNumeric': check(config, POSITIVE_NUMERIC_VALUE) | ||
'positiveNumeric': check(config, POSITIVE_NUMERIC_VALUE), | ||
'commaSeparated': check(config, COMMA_SEPARATED), | ||
'spaceSeparated': check(config, SPACE_SEPARATED) | ||
}; | ||
@@ -268,3 +289,5 @@ } | ||
function getPropertyInformation(propertyName) { | ||
return propertyInformationByAttributeName[lower(propertyName)]; | ||
var insensitive = lower(propertyName); | ||
return information[propertyToAttributeMapping[insensitive] || insensitive]; | ||
} | ||
@@ -276,3 +299,3 @@ | ||
getPropertyInformation.all = propertyInformationByAttributeName; | ||
getPropertyInformation.all = information; | ||
@@ -279,0 +302,0 @@ /* |
{ | ||
"name": "property-information", | ||
"version": "1.0.0", | ||
"version": "2.0.0", | ||
"description": "Information for HTML properties", | ||
@@ -29,3 +29,3 @@ "license": "MIT", | ||
"jscs-jsdoc": "^1.0.0", | ||
"mdast": "^1.0.0", | ||
"mdast": "^2.0.0", | ||
"mdast-comment-config": "^1.0.0", | ||
@@ -40,15 +40,13 @@ "mdast-github": "^1.0.0", | ||
"scripts": { | ||
"test-api": "node test.js", | ||
"test-coverage": "istanbul cover test.js", | ||
"test-travis": "npm run test-coverage", | ||
"test": "npm run test-api", | ||
"build-md": "mdast . --quiet --frail", | ||
"build-bundle": "browserify index.js --bare -s propertyInformation > property-information.js", | ||
"build-mangle": "esmangle property-information.js > property-information.min.js", | ||
"build": "npm run build-md && npm run build-bundle && npm run build-mangle", | ||
"lint-api": "eslint .", | ||
"lint-style": "jscs --reporter inline .", | ||
"lint": "npm run lint-api && npm run lint-style", | ||
"make": "npm run lint && npm run test-coverage", | ||
"build-md": "mdast . LICENSE --output --quiet", | ||
"build-bundle": "browserify index.js --bare -s propertyInformation > property-information.js", | ||
"postbuild-bundle": "esmangle property-information.js > property-information.min.js", | ||
"build": "npm run build-md && npm run build-bundle" | ||
"test-api": "node test.js", | ||
"test-coverage": "istanbul cover test.js", | ||
"test": "npm run build && npm run lint && npm run test-coverage" | ||
} | ||
} |
@@ -21,3 +21,3 @@ # property-information [![Build Status](https://img.shields.io/travis/wooorm/property-information.svg?style=flat)](https://travis-ci.org/wooorm/property-information) [![Coverage Status](https://img.shields.io/codecov/c/github/wooorm/mdast.svg)](https://codecov.io/github/wooorm/mdast) | ||
```js | ||
console.log(propertyInformation('itemScope')); | ||
console.log(propertyInformation('class')); | ||
``` | ||
@@ -36,3 +36,5 @@ | ||
"numeric": false, | ||
"positiveNumeric": false | ||
"positiveNumeric": false, | ||
"commaSeparated": false, | ||
"spaceSeparated": true | ||
} | ||
@@ -88,2 +90,31 @@ ``` | ||
* `spaceSeparated` (`boolean`) | ||
— Whether the value of the property is a | ||
[space-separated](https://html.spec.whatwg.org/#space-separated-tokens) | ||
list; | ||
* `commaSeparated` (`boolean`) | ||
— Whether the value of the property is a | ||
[comma-separated](https://html.spec.whatwg.org/#comma-separated-tokens) | ||
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`: | ||
```json | ||
{ | ||
"name": "itemscope", | ||
"propertyName": "itemScope", | ||
"mustUseAttribute": true, | ||
"mustUseProperty": false, | ||
"boolean": true, | ||
"overloadedBoolean": false, | ||
"numeric": false, | ||
"positiveNumeric": false, | ||
"commaSeparated": false, | ||
"spaceSeparated": true | ||
} | ||
``` | ||
## License | ||
@@ -90,0 +121,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14332
264
124