mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Rename CAN_BE_MINIMIZED to HAS_BOOLEANISH_VALUE
This commit is contained in:
@@ -34,7 +34,7 @@ var DOMPropertyInjection = {
|
||||
HAS_BOOLEAN_VALUE: 0x8,
|
||||
HAS_NUMERIC_VALUE: 0x10,
|
||||
HAS_POSITIVE_NUMERIC_VALUE: 0x20 | 0x10,
|
||||
CAN_BE_MINIMIZED: 0x40,
|
||||
HAS_BOOLEANISH_VALUE: 0x40,
|
||||
|
||||
/**
|
||||
* Inject some specialized knowledge about the DOM. This takes a config object
|
||||
@@ -116,8 +116,8 @@ var DOMPropertyInjection = {
|
||||
propConfig & DOMPropertyInjection.HAS_NUMERIC_VALUE;
|
||||
DOMProperty.hasPositiveNumericValue[propName] =
|
||||
propConfig & DOMPropertyInjection.HAS_POSITIVE_NUMERIC_VALUE;
|
||||
DOMProperty.canBeMinimized[propName] =
|
||||
propConfig & DOMPropertyInjection.CAN_BE_MINIMIZED;
|
||||
DOMProperty.hasBooleanishValue[propName] =
|
||||
propConfig & DOMPropertyInjection.HAS_BOOLEANISH_VALUE;
|
||||
|
||||
invariant(
|
||||
!DOMProperty.mustUseAttribute[propName] ||
|
||||
@@ -139,8 +139,8 @@ var DOMPropertyInjection = {
|
||||
);
|
||||
invariant(
|
||||
!DOMProperty.hasBooleanValue[propName] ||
|
||||
!DOMProperty.canBeMinimized[propName],
|
||||
'DOMProperty: Cannot have boolean value and be minimizable: %s',
|
||||
!DOMProperty.hasBooleanishValue[propName],
|
||||
'DOMProperty: Cannot have boolean and booleanish value: %s',
|
||||
propName
|
||||
);
|
||||
}
|
||||
@@ -246,7 +246,7 @@ var DOMProperty = {
|
||||
* to true; present with a value otherwise.
|
||||
* @type {Object}
|
||||
*/
|
||||
canBeMinimized: {},
|
||||
hasBooleanishValue: {},
|
||||
|
||||
/**
|
||||
* All of the isCustomAttribute() functions that have been injected.
|
||||
|
||||
@@ -30,7 +30,7 @@ function shouldIgnoreValue(name, value) {
|
||||
(DOMProperty.hasBooleanValue[name] && !value) ||
|
||||
(DOMProperty.hasNumericValue[name] && isNaN(value)) ||
|
||||
(DOMProperty.hasPositiveNumericValue[name] && (value < 1)) ||
|
||||
(DOMProperty.canBeMinimized[name] && value === false);
|
||||
(DOMProperty.hasBooleanishValue[name] && value === false);
|
||||
}
|
||||
|
||||
var processAttributeNameAndPrefix = memoizeStringOnly(function(name) {
|
||||
@@ -98,7 +98,7 @@ var DOMPropertyOperations = {
|
||||
}
|
||||
var attributeName = DOMProperty.getAttributeName[name];
|
||||
if (DOMProperty.hasBooleanValue[name] ||
|
||||
(DOMProperty.canBeMinimized[name] && value === true)) {
|
||||
(DOMProperty.hasBooleanishValue[name] && value === true)) {
|
||||
return escapeTextForBrowser(attributeName);
|
||||
}
|
||||
return processAttributeNameAndPrefix(attributeName) +
|
||||
|
||||
@@ -29,7 +29,7 @@ var HAS_SIDE_EFFECTS = DOMProperty.injection.HAS_SIDE_EFFECTS;
|
||||
var HAS_NUMERIC_VALUE = DOMProperty.injection.HAS_NUMERIC_VALUE;
|
||||
var HAS_POSITIVE_NUMERIC_VALUE =
|
||||
DOMProperty.injection.HAS_POSITIVE_NUMERIC_VALUE;
|
||||
var CAN_BE_MINIMIZED = DOMProperty.injection.CAN_BE_MINIMIZED;
|
||||
var HAS_BOOLEANISH_VALUE = DOMProperty.injection.HAS_BOOLEANISH_VALUE;
|
||||
|
||||
var DefaultDOMPropertyConfig = {
|
||||
isCustomAttribute: RegExp.prototype.test.bind(
|
||||
@@ -67,7 +67,7 @@ var DefaultDOMPropertyConfig = {
|
||||
defer: HAS_BOOLEAN_VALUE,
|
||||
dir: null,
|
||||
disabled: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
|
||||
download: CAN_BE_MINIMIZED,
|
||||
download: HAS_BOOLEANISH_VALUE,
|
||||
draggable: null,
|
||||
encType: null,
|
||||
form: MUST_USE_ATTRIBUTE,
|
||||
|
||||
@@ -99,7 +99,7 @@ describe('DOMPropertyOperations', function() {
|
||||
)).toBe('');
|
||||
});
|
||||
|
||||
it('should create markup for minimizable properties', function() {
|
||||
it('should create markup for booleanish properties', function() {
|
||||
expect(DOMPropertyOperations.createMarkupForProperty(
|
||||
'download',
|
||||
'simple'
|
||||
|
||||
Reference in New Issue
Block a user