Skip to content

Commit

Permalink
Add start property that is used by the <ol> tag
Browse files Browse the repository at this point in the history
Property was missing
  • Loading branch information
Josh Yudaken authored and zpao committed Apr 10, 2014
1 parent 4f1ca0e commit 5c9d616
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
16 changes: 13 additions & 3 deletions src/browser/ui/dom/DOMProperty.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ var DOMPropertyInjection = {
MUST_USE_PROPERTY: 0x2,
HAS_SIDE_EFFECTS: 0x4,
HAS_BOOLEAN_VALUE: 0x8,
HAS_POSITIVE_NUMERIC_VALUE: 0x10,
HAS_NUMERIC_VALUE: 0x10,
HAS_POSITIVE_NUMERIC_VALUE: 0x20 | 0x10,

/**
* Inject some specialized knowledge about the DOM. This takes a config object
Expand Down Expand Up @@ -110,6 +111,8 @@ var DOMPropertyInjection = {
propConfig & DOMPropertyInjection.HAS_SIDE_EFFECTS;
DOMProperty.hasBooleanValue[propName] =
propConfig & DOMPropertyInjection.HAS_BOOLEAN_VALUE;
DOMProperty.hasNumericValue[propName] =
propConfig & DOMPropertyInjection.HAS_NUMERIC_VALUE;
DOMProperty.hasPositiveNumericValue[propName] =
propConfig & DOMPropertyInjection.HAS_POSITIVE_NUMERIC_VALUE;

Expand All @@ -127,8 +130,8 @@ var DOMPropertyInjection = {
);
invariant(
!DOMProperty.hasBooleanValue[propName] ||
!DOMProperty.hasPositiveNumericValue[propName],
'DOMProperty: Cannot have both boolean and positive numeric value: %s',
!DOMProperty.hasNumericValue[propName],
'DOMProperty: Cannot have both boolean and numeric value: %s',
propName
);
}
Expand Down Expand Up @@ -214,6 +217,13 @@ var DOMProperty = {
*/
hasBooleanValue: {},

/**
* Whether the property must be numeric or parse as a
* numeric and should be removed when set to a falsey value.
* @type {Object}
*/
hasNumericValue: {},

/**
* Whether the property must be positive numeric or parse as a positive
* numeric and should be removed when set to a falsey value.
Expand Down
5 changes: 3 additions & 2 deletions src/browser/ui/dom/DOMPropertyOperations.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ var warning = require('warning');

function shouldIgnoreValue(name, value) {
return value == null ||
DOMProperty.hasBooleanValue[name] && !value ||
DOMProperty.hasPositiveNumericValue[name] && (isNaN(value) || value < 1);
(DOMProperty.hasBooleanValue[name] && !value) ||
(DOMProperty.hasNumericValue[name] && isNaN(value)) ||
(DOMProperty.hasPositiveNumericValue[name] && (value < 1));
}

var processAttributeNameAndPrefix = memoizeStringOnly(function(name) {
Expand Down
2 changes: 2 additions & 0 deletions src/browser/ui/dom/DefaultDOMPropertyConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;
var MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY;
var HAS_BOOLEAN_VALUE = DOMProperty.injection.HAS_BOOLEAN_VALUE;
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;

Expand Down Expand Up @@ -116,6 +117,7 @@ var DefaultDOMPropertyConfig = {
src: null,
srcDoc: MUST_USE_PROPERTY,
srcSet: null,
start: HAS_NUMERIC_VALUE,
step: null,
style: null,
tabIndex: null,
Expand Down

0 comments on commit 5c9d616

Please sign in to comment.