Generate XML-compatible tags and boolean attributes

This commit is contained in:
Austin Wright
2015-03-14 13:53:12 -07:00
parent 68a2f89cc6
commit 8bc828aa7c
2 changed files with 9 additions and 9 deletions
+8 -8
View File
@@ -208,12 +208,12 @@ ReactDOMComponent.Mixin = {
mountComponent: function(rootID, transaction, context) {
this._rootNodeID = rootID;
assertValidProps(this, this._currentElement.props);
var closeTag = omittedCloseTags[this._tag] ? '' : '</' + this._tag + '>';
return (
this._createOpenTagMarkupAndPutListeners(transaction) +
this._createContentMarkup(transaction, context) +
closeTag
);
var tagOpen = this._createOpenTagMarkupAndPutListeners(transaction);
var tagContent = this._createContentMarkup(transaction, context);
if(!tagContent && omittedCloseTags[this._tag]){
return tagOpen + '/>';
}
return tagOpen + '>' + tagContent + '</' + this._tag + '>';
},
/**
@@ -260,11 +260,11 @@ ReactDOMComponent.Mixin = {
// For static pages, no need to put React ID and checksum. Saves lots of
// bytes.
if (transaction.renderToStaticMarkup) {
return ret + '>';
return ret;
}
var markupForID = DOMPropertyOperations.createMarkupForID(this._rootNodeID);
return ret + ' ' + markupForID + '>';
return ret + ' ' + markupForID;
},
/**
+1 -1
View File
@@ -96,7 +96,7 @@ var DOMPropertyOperations = {
var attributeName = DOMProperty.getAttributeName[name];
if (DOMProperty.hasBooleanValue[name] ||
(DOMProperty.hasOverloadedBooleanValue[name] && value === true)) {
return attributeName;
return attributeName + '=""';
}
return attributeName + '=' + quoteAttributeValueForBrowser(value);
} else if (DOMProperty.isCustomAttribute(name)) {