Skip to content

Commit

Permalink
Merge pull request #3047 from syranide/escbrow2
Browse files Browse the repository at this point in the history
Drop processAttributeNameAndPrefix and invalid attribute name escaping
  • Loading branch information
syranide committed Feb 5, 2015
2 parents 123d218 + 6af987c commit c7e4f55
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions src/browser/ui/dom/DOMPropertyOperations.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ var DOMProperty = require('DOMProperty');

var escapeTextContentForBrowser = require('escapeTextContentForBrowser');
var quoteAttributeValueForBrowser = require('quoteAttributeValueForBrowser');
var memoizeStringOnly = require('memoizeStringOnly');
var warning = require('warning');

function shouldIgnoreValue(name, value) {
Expand All @@ -27,10 +26,6 @@ function shouldIgnoreValue(name, value) {
(DOMProperty.hasOverloadedBooleanValue[name] && value === false);
}

var processAttributeNameAndPrefix = memoizeStringOnly(function(name) {
return escapeTextContentForBrowser(name) + '=';
});

if (__DEV__) {
var reactProps = {
children: true,
Expand Down Expand Up @@ -82,7 +77,7 @@ var DOMPropertyOperations = {
* @return {string} Markup string.
*/
createMarkupForID: function(id) {
return processAttributeNameAndPrefix(DOMProperty.ID_ATTRIBUTE_NAME) +
return DOMProperty.ID_ATTRIBUTE_NAME + '=' +
quoteAttributeValueForBrowser(id);
},

Expand All @@ -102,16 +97,14 @@ var DOMPropertyOperations = {
var attributeName = DOMProperty.getAttributeName[name];
if (DOMProperty.hasBooleanValue[name] ||
(DOMProperty.hasOverloadedBooleanValue[name] && value === true)) {
return escapeTextContentForBrowser(attributeName);
return attributeName;
}
return processAttributeNameAndPrefix(attributeName) +
quoteAttributeValueForBrowser(value);
return attributeName + '=' + quoteAttributeValueForBrowser(value);
} else if (DOMProperty.isCustomAttribute(name)) {
if (value == null) {
return '';
}
return processAttributeNameAndPrefix(name) +
quoteAttributeValueForBrowser(value);
return name + '=' + quoteAttributeValueForBrowser(value);
} else if (__DEV__) {
warnUnknownProperty(name);
}
Expand Down

0 comments on commit c7e4f55

Please sign in to comment.