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

This reverts commit 0e9a7575ce.
This commit is contained in:
Brandon Dail
2017-12-07 22:06:20 +00:00
committed by Dan Abramov
parent d5e3b1355b
commit 2d95fa26fe
2 changed files with 10 additions and 10 deletions
+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)