Revert "Remove empty value for boolean attributes in SSR (#11708)" (#11798)

This reverts commit e0c3113743.
This commit is contained in:
Brandon Dail authored and Dan Abramov committed 2017-12-07 22:06:20 +00:00
1 parent 41f920e430
commit 5301c41417
2 files changed
+10 -10

No files matched your search

+9 -9
View File
@@ -440,9 +440,9 @@ describe('ReactDOMSelect', () => {
</select>
);
const markup = ReactDOMServer.renderToString(stub);
expect(markup).toContain('<option selected value="giraffe"');
expect(markup).not.toContain('<option selected value="monkey"');
expect(markup).not.toContain('<option selected value="gorilla"');
expect(markup).toContain('<option selected="" value="giraffe"');
expect(markup).not.toContain('<option selected="" value="monkey"');
expect(markup).not.toContain('<option selected="" value="gorilla"');
});
it('should support server-side rendering with defaultValue', () => {
@@ -454,9 +454,9 @@ describe('ReactDOMSelect', () => {
</select>
);
const markup = ReactDOMServer.renderToString(stub);
expect(markup).toContain('<option selected value="giraffe"');
expect(markup).not.toContain('<option selected value="monkey"');
expect(markup).not.toContain('<option selected value="gorilla"');
expect(markup).toContain('<option selected="" value="giraffe"');
expect(markup).not.toContain('<option selected="" value="monkey"');
expect(markup).not.toContain('<option selected="" value="gorilla"');
});
it('should support server-side rendering with multiple', () => {
@@ -468,9 +468,9 @@ describe('ReactDOMSelect', () => {
</select>
);
const markup = ReactDOMServer.renderToString(stub);
expect(markup).toContain('<option selected value="giraffe"');
expect(markup).toContain('<option selected value="gorilla"');
expect(markup).not.toContain('<option selected value="monkey"');
expect(markup).toContain('<option selected="" value="giraffe"');
expect(markup).toContain('<option selected="" value="gorilla"');
expect(markup).not.toContain('<option selected="" value="monkey"');
});
it('should not control defaultValue if readding options', () => {
+1 -1
View File
@@ -90,7 +90,7 @@ export function createMarkupForProperty(name, value) {
propertyInfo.hasBooleanValue ||
(propertyInfo.hasOverloadedBooleanValue && value === true)
) {
return attributeName;
return attributeName + '=""';
} else if (
typeof value !== 'boolean' ||
shouldAttributeAcceptBooleanValue(name)