mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Don't double-escape style names
Previously we were escaping both in createMarkupForStyles and then in createMarkupForProperty; now we escape only in the latter (otherwise the hypothetical style name `b&ckground` would become `b&ckground`). Test Plan: grunt fasttest
This commit is contained in:
@@ -252,6 +252,12 @@ describe('ReactDOMComponent', function() {
|
||||
expect(genMarkup({ className: 'a b' })).toHaveAttribute('class', 'a b');
|
||||
expect(genMarkup({ className: '' })).toHaveAttribute('class', '');
|
||||
});
|
||||
|
||||
it("should escape style names and values", function() {
|
||||
expect(genMarkup({
|
||||
style: {'b&ckground': '<3'}
|
||||
})).toHaveAttribute('style', 'b&ckground:<3;');
|
||||
});
|
||||
});
|
||||
|
||||
describe('createContentMarkup', function() {
|
||||
|
||||
@@ -22,12 +22,11 @@
|
||||
var CSSProperty = require('CSSProperty');
|
||||
|
||||
var dangerousStyleValue = require('dangerousStyleValue');
|
||||
var escapeTextForBrowser = require('escapeTextForBrowser');
|
||||
var hyphenateStyleName = require('hyphenateStyleName');
|
||||
var memoizeStringOnly = require('memoizeStringOnly');
|
||||
|
||||
var processStyleName = memoizeStringOnly(function(styleName) {
|
||||
return escapeTextForBrowser(hyphenateStyleName(styleName));
|
||||
return hyphenateStyleName(styleName);
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -42,6 +41,7 @@ var CSSPropertyOperations = {
|
||||
* "width:200px;height:0;"
|
||||
*
|
||||
* Undefined values are ignored so that declarative programming is easier.
|
||||
* The result should be HTML-escaped before insertion into the DOM.
|
||||
*
|
||||
* @param {object} styles
|
||||
* @return {?string}
|
||||
|
||||
Reference in New Issue
Block a user