react-property
Advanced tools
Comparing version 2.0.0 to 2.0.1
407
lib/index.js
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
function _iterableToArrayLimit(r, l) { | ||
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; | ||
if (null != t) { | ||
var e, | ||
n, | ||
i, | ||
u, | ||
a = [], | ||
f = !0, | ||
o = !1; | ||
try { | ||
if (i = (t = t.call(r)).next, 0 === l) { | ||
if (Object(t) !== t) return; | ||
f = !1; | ||
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); | ||
} catch (r) { | ||
o = !0, n = r; | ||
} finally { | ||
try { | ||
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; | ||
} finally { | ||
if (o) throw n; | ||
} | ||
} | ||
return a; | ||
} | ||
} | ||
function _slicedToArray(arr, i) { | ||
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); | ||
} | ||
function _arrayWithHoles(arr) { | ||
if (Array.isArray(arr)) return arr; | ||
} | ||
function _iterableToArrayLimit(arr, i) { | ||
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; | ||
if (_i == null) return; | ||
var _arr = []; | ||
var _n = true; | ||
var _d = false; | ||
var _s, _e; | ||
try { | ||
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { | ||
_arr.push(_s.value); | ||
if (i && _arr.length === i) break; | ||
} | ||
} catch (err) { | ||
_d = true; | ||
_e = err; | ||
} finally { | ||
try { | ||
if (!_n && _i["return"] != null) _i["return"](); | ||
} finally { | ||
if (_d) throw _e; | ||
} | ||
} | ||
return _arr; | ||
} | ||
function _unsupportedIterableToArray(o, minLen) { | ||
@@ -51,11 +44,7 @@ if (!o) return; | ||
} | ||
function _arrayLikeToArray(arr, len) { | ||
if (len == null || len > arr.length) len = arr.length; | ||
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; | ||
return arr2; | ||
} | ||
function _nonIterableRest() { | ||
@@ -67,25 +56,31 @@ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
// It is handled by React separately and shouldn't be written to the DOM. | ||
var RESERVED = 0; // A simple string attribute. | ||
var RESERVED = 0; | ||
// A simple string attribute. | ||
// Attributes that aren't in the filter are presumed to have this type. | ||
var STRING = 1; | ||
var STRING = 1; // A string attribute that accepts booleans in React. In HTML, these are called | ||
// A string attribute that accepts booleans in React. In HTML, these are called | ||
// "enumerated" attributes with "true" and "false" as possible values. | ||
// When true, it should be set to a "true" string. | ||
// When false, it should be set to a "false" string. | ||
var BOOLEANISH_STRING = 2; | ||
var BOOLEANISH_STRING = 2; // A real boolean attribute. | ||
// A real boolean attribute. | ||
// When true, it should be present (set either to an empty string or its name). | ||
// When false, it should be omitted. | ||
var BOOLEAN = 3; | ||
var BOOLEAN = 3; // An attribute that can be used as a flag as well as with a value. | ||
// An attribute that can be used as a flag as well as with a value. | ||
// When true, it should be present (set either to an empty string or its name). | ||
// When false, it should be omitted. | ||
// For any other value, should be present with that value. | ||
var OVERLOADED_BOOLEAN = 4; | ||
var OVERLOADED_BOOLEAN = 4; // An attribute that must be numeric or parse as a numeric. | ||
// An attribute that must be numeric or parse as a numeric. | ||
// When falsy, it should be removed. | ||
var NUMERIC = 5; | ||
var NUMERIC = 5; // An attribute that must be positive numeric or parse as a positive numeric. | ||
// An attribute that must be positive numeric or parse as a positive numeric. | ||
// When falsy, it should be removed. | ||
var POSITIVE_NUMERIC = 6; | ||
@@ -95,3 +90,2 @@ function getPropertyInfo(name) { | ||
} | ||
function PropertyInfoRecord(name, type, mustUseProperty, attributeName, attributeNamespace, sanitizeURL, removeEmptyString) { | ||
@@ -106,10 +100,12 @@ this.acceptsBooleans = type === BOOLEANISH_STRING || type === BOOLEAN || type === OVERLOADED_BOOLEAN; | ||
this.removeEmptyString = removeEmptyString; | ||
} // When adding attributes to this list, be sure to also add them to | ||
} | ||
// When adding attributes to this list, be sure to also add them to | ||
// the `possibleStandardNames` module to ensure casing and incorrect | ||
// name warnings. | ||
var properties = {}; | ||
var properties = {}; // These props are reserved by React. They shouldn't be written to the DOM. | ||
var reservedProps = ['children', 'dangerouslySetInnerHTML', // TODO: This prevents the assignment of defaultValue to regular | ||
// These props are reserved by React. They shouldn't be written to the DOM. | ||
var reservedProps = ['children', 'dangerouslySetInnerHTML', | ||
// TODO: This prevents the assignment of defaultValue to regular | ||
// elements (not just inputs). Now that ReactDOMInput assigns to the | ||
@@ -119,103 +115,166 @@ // defaultValue property -- do we need this? | ||
reservedProps.forEach(function (name) { | ||
properties[name] = new PropertyInfoRecord(name, RESERVED, false, // mustUseProperty | ||
name, // attributeName | ||
null, // attributeNamespace | ||
false, // sanitizeURL | ||
false); | ||
}); // A few React string attributes have a different name. | ||
properties[name] = new PropertyInfoRecord(name, RESERVED, false, | ||
// mustUseProperty | ||
name, | ||
// attributeName | ||
null, | ||
// attributeNamespace | ||
false, | ||
// sanitizeURL | ||
false) // removeEmptyString | ||
; | ||
}); | ||
// A few React string attributes have a different name. | ||
// This is a mapping from React prop names to the attribute names. | ||
[['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor', 'for'], ['httpEquiv', 'http-equiv']].forEach(function (_ref) { | ||
var _ref2 = _slicedToArray(_ref, 2), | ||
name = _ref2[0], | ||
attributeName = _ref2[1]; | ||
name = _ref2[0], | ||
attributeName = _ref2[1]; | ||
properties[name] = new PropertyInfoRecord(name, STRING, false, | ||
// mustUseProperty | ||
attributeName, | ||
// attributeName | ||
null, | ||
// attributeNamespace | ||
false, | ||
// sanitizeURL | ||
false) // removeEmptyString | ||
; | ||
}); | ||
properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty | ||
attributeName, // attributeName | ||
null, // attributeNamespace | ||
false, // sanitizeURL | ||
false); | ||
}); // These are "enumerated" HTML attributes that accept "true" and "false". | ||
// These are "enumerated" HTML attributes that accept "true" and "false". | ||
// In React, we let users pass `true` and `false` even though technically | ||
// these aren't boolean attributes (they are coerced to strings). | ||
['contentEditable', 'draggable', 'spellCheck', 'value'].forEach(function (name) { | ||
properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, | ||
// mustUseProperty | ||
name.toLowerCase(), | ||
// attributeName | ||
null, | ||
// attributeNamespace | ||
false, | ||
// sanitizeURL | ||
false) // removeEmptyString | ||
; | ||
}); | ||
['contentEditable', 'draggable', 'spellCheck', 'value'].forEach(function (name) { | ||
properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty | ||
name.toLowerCase(), // attributeName | ||
null, // attributeNamespace | ||
false, // sanitizeURL | ||
false); | ||
}); // These are "enumerated" SVG attributes that accept "true" and "false". | ||
// These are "enumerated" SVG attributes that accept "true" and "false". | ||
// In React, we let users pass `true` and `false` even though technically | ||
// these aren't boolean attributes (they are coerced to strings). | ||
// Since these are SVG attributes, their attribute names are case-sensitive. | ||
['autoReverse', 'externalResourcesRequired', 'focusable', 'preserveAlpha'].forEach(function (name) { | ||
properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty | ||
name, // attributeName | ||
null, // attributeNamespace | ||
false, // sanitizeURL | ||
false); | ||
}); // These are HTML boolean attributes. | ||
properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, | ||
// mustUseProperty | ||
name, | ||
// attributeName | ||
null, | ||
// attributeNamespace | ||
false, | ||
// sanitizeURL | ||
false) // removeEmptyString | ||
; | ||
}); | ||
['allowFullScreen', 'async', // Note: there is a special case that prevents it from being written to the DOM | ||
// These are HTML boolean attributes. | ||
['allowFullScreen', 'async', | ||
// Note: there is a special case that prevents it from being written to the DOM | ||
// on the client side because the browsers are inconsistent. Instead we call focus(). | ||
'autoFocus', 'autoPlay', 'controls', 'default', 'defer', 'disabled', 'disablePictureInPicture', 'disableRemotePlayback', 'formNoValidate', 'hidden', 'loop', 'noModule', 'noValidate', 'open', 'playsInline', 'readOnly', 'required', 'reversed', 'scoped', 'seamless', // Microdata | ||
'autoFocus', 'autoPlay', 'controls', 'default', 'defer', 'disabled', 'disablePictureInPicture', 'disableRemotePlayback', 'formNoValidate', 'hidden', 'loop', 'noModule', 'noValidate', 'open', 'playsInline', 'readOnly', 'required', 'reversed', 'scoped', 'seamless', | ||
// Microdata | ||
'itemScope'].forEach(function (name) { | ||
properties[name] = new PropertyInfoRecord(name, BOOLEAN, false, // mustUseProperty | ||
name.toLowerCase(), // attributeName | ||
null, // attributeNamespace | ||
false, // sanitizeURL | ||
false); | ||
}); // These are the few React props that we set as DOM properties | ||
properties[name] = new PropertyInfoRecord(name, BOOLEAN, false, | ||
// mustUseProperty | ||
name.toLowerCase(), | ||
// attributeName | ||
null, | ||
// attributeNamespace | ||
false, | ||
// sanitizeURL | ||
false) // removeEmptyString | ||
; | ||
}); | ||
// These are the few React props that we set as DOM properties | ||
// rather than attributes. These are all booleans. | ||
['checked', | ||
// Note: `option.selected` is not updated if `select.multiple` is | ||
// disabled with `removeAttribute`. We have special logic for handling this. | ||
'multiple', 'muted', 'selected' | ||
['checked', // Note: `option.selected` is not updated if `select.multiple` is | ||
// disabled with `removeAttribute`. We have special logic for handling this. | ||
'multiple', 'muted', 'selected' // NOTE: if you add a camelCased prop to this list, | ||
// NOTE: if you add a camelCased prop to this list, | ||
// you'll need to set attributeName to name.toLowerCase() | ||
// instead in the assignment below. | ||
].forEach(function (name) { | ||
properties[name] = new PropertyInfoRecord(name, BOOLEAN, true, // mustUseProperty | ||
name, // attributeName | ||
null, // attributeNamespace | ||
false, // sanitizeURL | ||
false); | ||
}); // These are HTML attributes that are "overloaded booleans": they behave like | ||
properties[name] = new PropertyInfoRecord(name, BOOLEAN, true, | ||
// mustUseProperty | ||
name, | ||
// attributeName | ||
null, | ||
// attributeNamespace | ||
false, | ||
// sanitizeURL | ||
false) // removeEmptyString | ||
; | ||
}); | ||
// These are HTML attributes that are "overloaded booleans": they behave like | ||
// booleans, but can also accept a string value. | ||
['capture', 'download' | ||
['capture', 'download' // NOTE: if you add a camelCased prop to this list, | ||
// NOTE: if you add a camelCased prop to this list, | ||
// you'll need to set attributeName to name.toLowerCase() | ||
// instead in the assignment below. | ||
].forEach(function (name) { | ||
properties[name] = new PropertyInfoRecord(name, OVERLOADED_BOOLEAN, false, // mustUseProperty | ||
name, // attributeName | ||
null, // attributeNamespace | ||
false, // sanitizeURL | ||
false); | ||
}); // These are HTML attributes that must be positive numbers. | ||
properties[name] = new PropertyInfoRecord(name, OVERLOADED_BOOLEAN, false, | ||
// mustUseProperty | ||
name, | ||
// attributeName | ||
null, | ||
// attributeNamespace | ||
false, | ||
// sanitizeURL | ||
false) // removeEmptyString | ||
; | ||
}); | ||
['cols', 'rows', 'size', 'span' // NOTE: if you add a camelCased prop to this list, | ||
// These are HTML attributes that must be positive numbers. | ||
['cols', 'rows', 'size', 'span' | ||
// NOTE: if you add a camelCased prop to this list, | ||
// you'll need to set attributeName to name.toLowerCase() | ||
// instead in the assignment below. | ||
].forEach(function (name) { | ||
properties[name] = new PropertyInfoRecord(name, POSITIVE_NUMERIC, false, // mustUseProperty | ||
name, // attributeName | ||
null, // attributeNamespace | ||
false, // sanitizeURL | ||
false); | ||
}); // These are HTML attributes that must be numbers. | ||
properties[name] = new PropertyInfoRecord(name, POSITIVE_NUMERIC, false, | ||
// mustUseProperty | ||
name, | ||
// attributeName | ||
null, | ||
// attributeNamespace | ||
false, | ||
// sanitizeURL | ||
false) // removeEmptyString | ||
; | ||
}); | ||
// These are HTML attributes that must be numbers. | ||
['rowSpan', 'start'].forEach(function (name) { | ||
properties[name] = new PropertyInfoRecord(name, NUMERIC, false, // mustUseProperty | ||
name.toLowerCase(), // attributeName | ||
null, // attributeNamespace | ||
false, // sanitizeURL | ||
false); | ||
properties[name] = new PropertyInfoRecord(name, NUMERIC, false, | ||
// mustUseProperty | ||
name.toLowerCase(), | ||
// attributeName | ||
null, | ||
// attributeNamespace | ||
false, | ||
// sanitizeURL | ||
false) // removeEmptyString | ||
; | ||
}); | ||
var CAMELIZE = /[\-\:]([a-z])/g; | ||
var capitalize = function capitalize(token) { | ||
return token[1].toUpperCase(); | ||
}; // This is a list of all SVG attributes that need special casing, namespacing, | ||
}; | ||
// This is a list of all SVG attributes that need special casing, namespacing, | ||
// or boolean value assignment. Regular attributes that just accept strings | ||
@@ -225,5 +284,5 @@ // and have the same names are omitted, just like in the HTML attribute filter. | ||
// scraping the MDN documentation. | ||
['accent-height', 'alignment-baseline', 'arabic-form', 'baseline-shift', 'cap-height', 'clip-path', 'clip-rule', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'dominant-baseline', 'enable-background', 'fill-opacity', 'fill-rule', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'glyph-name', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'horiz-adv-x', 'horiz-origin-x', 'image-rendering', 'letter-spacing', 'lighting-color', 'marker-end', 'marker-mid', 'marker-start', 'overline-position', 'overline-thickness', 'paint-order', 'panose-1', 'pointer-events', 'rendering-intent', 'shape-rendering', 'stop-color', 'stop-opacity', 'strikethrough-position', 'strikethrough-thickness', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'text-anchor', 'text-decoration', 'text-rendering', 'underline-position', 'underline-thickness', 'unicode-bidi', 'unicode-range', 'units-per-em', 'v-alphabetic', 'v-hanging', 'v-ideographic', 'v-mathematical', 'vector-effect', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'word-spacing', 'writing-mode', 'xmlns:xlink', 'x-height' | ||
['accent-height', 'alignment-baseline', 'arabic-form', 'baseline-shift', 'cap-height', 'clip-path', 'clip-rule', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'dominant-baseline', 'enable-background', 'fill-opacity', 'fill-rule', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'glyph-name', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'horiz-adv-x', 'horiz-origin-x', 'image-rendering', 'letter-spacing', 'lighting-color', 'marker-end', 'marker-mid', 'marker-start', 'overline-position', 'overline-thickness', 'paint-order', 'panose-1', 'pointer-events', 'rendering-intent', 'shape-rendering', 'stop-color', 'stop-opacity', 'strikethrough-position', 'strikethrough-thickness', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'text-anchor', 'text-decoration', 'text-rendering', 'underline-position', 'underline-thickness', 'unicode-bidi', 'unicode-range', 'units-per-em', 'v-alphabetic', 'v-hanging', 'v-ideographic', 'v-mathematical', 'vector-effect', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'word-spacing', 'writing-mode', 'xmlns:xlink', 'x-height' // NOTE: if you add a camelCased prop to this list, | ||
// NOTE: if you add a camelCased prop to this list, | ||
// you'll need to set attributeName to name.toLowerCase() | ||
@@ -233,9 +292,16 @@ // instead in the assignment below. | ||
var name = attributeName.replace(CAMELIZE, capitalize); | ||
properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty | ||
attributeName, null, // attributeNamespace | ||
false, // sanitizeURL | ||
false); | ||
}); // String SVG attributes with the xlink namespace. | ||
properties[name] = new PropertyInfoRecord(name, STRING, false, | ||
// mustUseProperty | ||
attributeName, null, | ||
// attributeNamespace | ||
false, | ||
// sanitizeURL | ||
false) // removeEmptyString | ||
; | ||
}); | ||
['xlink:actuate', 'xlink:arcrole', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type' // NOTE: if you add a camelCased prop to this list, | ||
// String SVG attributes with the xlink namespace. | ||
['xlink:actuate', 'xlink:arcrole', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type' | ||
// NOTE: if you add a camelCased prop to this list, | ||
// you'll need to set attributeName to name.toLowerCase() | ||
@@ -245,8 +311,14 @@ // instead in the assignment below. | ||
var name = attributeName.replace(CAMELIZE, capitalize); | ||
properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty | ||
attributeName, 'http://www.w3.org/1999/xlink', false, // sanitizeURL | ||
false); | ||
}); // String SVG attributes with the xml namespace. | ||
properties[name] = new PropertyInfoRecord(name, STRING, false, | ||
// mustUseProperty | ||
attributeName, 'http://www.w3.org/1999/xlink', false, | ||
// sanitizeURL | ||
false) // removeEmptyString | ||
; | ||
}); | ||
['xml:base', 'xml:lang', 'xml:space' // NOTE: if you add a camelCased prop to this list, | ||
// String SVG attributes with the xml namespace. | ||
['xml:base', 'xml:lang', 'xml:space' | ||
// NOTE: if you add a camelCased prop to this list, | ||
// you'll need to set attributeName to name.toLowerCase() | ||
@@ -256,37 +328,56 @@ // instead in the assignment below. | ||
var name = attributeName.replace(CAMELIZE, capitalize); | ||
properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty | ||
attributeName, 'http://www.w3.org/XML/1998/namespace', false, // sanitizeURL | ||
false); | ||
}); // These attribute exists both in HTML and SVG. | ||
properties[name] = new PropertyInfoRecord(name, STRING, false, | ||
// mustUseProperty | ||
attributeName, 'http://www.w3.org/XML/1998/namespace', false, | ||
// sanitizeURL | ||
false) // removeEmptyString | ||
; | ||
}); | ||
// These attribute exists both in HTML and SVG. | ||
// The attribute name is case-sensitive in SVG so we can't just use | ||
// the React name like we do for attributes that exist only in HTML. | ||
['tabIndex', 'crossOrigin'].forEach(function (attributeName) { | ||
properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, | ||
// mustUseProperty | ||
attributeName.toLowerCase(), | ||
// attributeName | ||
null, | ||
// attributeNamespace | ||
false, | ||
// sanitizeURL | ||
false) // removeEmptyString | ||
; | ||
}); | ||
['tabIndex', 'crossOrigin'].forEach(function (attributeName) { | ||
properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty | ||
attributeName.toLowerCase(), // attributeName | ||
null, // attributeNamespace | ||
false, // sanitizeURL | ||
false); | ||
}); // These attributes accept URLs. These must not allow javascript: URLS. | ||
// These attributes accept URLs. These must not allow javascript: URLS. | ||
// These will also need to accept Trusted Types object in the future. | ||
var xlinkHref = 'xlinkHref'; | ||
properties[xlinkHref] = new PropertyInfoRecord('xlinkHref', STRING, false, | ||
// mustUseProperty | ||
'xlink:href', 'http://www.w3.org/1999/xlink', true, | ||
// sanitizeURL | ||
false) // removeEmptyString | ||
; | ||
var xlinkHref = 'xlinkHref'; | ||
properties[xlinkHref] = new PropertyInfoRecord('xlinkHref', STRING, false, // mustUseProperty | ||
'xlink:href', 'http://www.w3.org/1999/xlink', true, // sanitizeURL | ||
false); | ||
['src', 'href', 'action', 'formAction'].forEach(function (attributeName) { | ||
properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty | ||
attributeName.toLowerCase(), // attributeName | ||
null, // attributeNamespace | ||
true, // sanitizeURL | ||
true); | ||
properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, | ||
// mustUseProperty | ||
attributeName.toLowerCase(), | ||
// attributeName | ||
null, | ||
// attributeNamespace | ||
true, | ||
// sanitizeURL | ||
true) // removeEmptyString | ||
; | ||
}); | ||
var _require = require('../lib/possibleStandardNamesOptimized'), | ||
CAMELCASE = _require.CAMELCASE, | ||
SAME = _require.SAME, | ||
possibleStandardNamesOptimized = _require.possibleStandardNames; | ||
CAMELCASE = _require.CAMELCASE, | ||
SAME = _require.SAME, | ||
possibleStandardNamesOptimized = _require.possibleStandardNames; | ||
var ATTRIBUTE_NAME_START_CHAR = ":A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD"; | ||
var ATTRIBUTE_NAME_CHAR = ATTRIBUTE_NAME_START_CHAR + "\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040"; | ||
/** | ||
@@ -300,8 +391,7 @@ * Checks whether a property name is a custom attribute. | ||
*/ | ||
var isCustomAttribute = RegExp.prototype.test.bind( // eslint-disable-next-line no-misleading-character-class | ||
var isCustomAttribute = RegExp.prototype.test.bind( | ||
// eslint-disable-next-line no-misleading-character-class | ||
new RegExp('^(data|aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$')); | ||
var possibleStandardNames = Object.keys(possibleStandardNamesOptimized).reduce(function (accumulator, standardName) { | ||
var propName = possibleStandardNamesOptimized[standardName]; | ||
if (propName === SAME) { | ||
@@ -314,3 +404,2 @@ accumulator[standardName] = standardName; | ||
} | ||
return accumulator; | ||
@@ -317,0 +406,0 @@ }, {}); |
@@ -9,2 +9,3 @@ 'use strict'; | ||
*/ | ||
// When adding attributes to the HTML or SVG allowed attribute list, be sure to | ||
@@ -11,0 +12,0 @@ // also add them to this module to ensure casing and incorrect name |
{ | ||
"name": "react-property", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "HTML and SVG DOM property configs used by React.", | ||
"main": "lib/index.js", | ||
"scripts": { | ||
"build": "rollup -c rollup.config.possibleStandardNames.js && scripts/build.js && rollup -c", | ||
"build": "rollup -c rollup.config.possibleStandardNames.mjs && scripts/build.js && rollup -c", | ||
"clean": "rm -rf lib", | ||
@@ -37,14 +37,14 @@ "lint": "eslint --ignore-path .gitignore .", | ||
"devDependencies": { | ||
"@babel/preset-env": "^7.15.4", | ||
"@babel/preset-flow": "^7.14.5", | ||
"@rollup/plugin-alias": "^3.1.5", | ||
"@rollup/plugin-babel": "^5.3.0", | ||
"eslint": "^7.32.0", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"jest": "^27.1.0", | ||
"prettier": "^2.3.2", | ||
"rollup": "^2.56.3" | ||
"@babel/preset-env": "7.23.2", | ||
"@babel/preset-flow": "7.22.15", | ||
"@rollup/plugin-alias": "5.0.1", | ||
"@rollup/plugin-babel": "6.0.4", | ||
"eslint": "8.52.0", | ||
"eslint-plugin-prettier": "5.0.1", | ||
"jest": "29.7.0", | ||
"prettier": "3.0.3", | ||
"rollup": "4.1.4" | ||
}, | ||
"license": "MIT", | ||
"gitHead": "1637f549753213cc85dbcad168c48c49e11a0339" | ||
"gitHead": "907833dc2d968d1a7150a2da5efc646bad128f1f" | ||
} |
@@ -9,3 +9,3 @@ # react-property | ||
Try [Replit](https://repl.it/@remarkablemark/react-property) demo. | ||
Try [Replit](https://replit.com/@remarkablemark/react-property) demo. | ||
@@ -20,12 +20,14 @@ ## Install | ||
Import module: | ||
Import ES Module: | ||
```js | ||
// CommonJS | ||
const reactProperty = require('react-property'); | ||
// ES Modules | ||
import reactProperty from 'react-property'; | ||
``` | ||
Require with CommonJS: | ||
```js | ||
const reactProperty = require('react-property'); | ||
``` | ||
Module contains: | ||
@@ -32,0 +34,0 @@ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
41105
1365
56
0