html mode instead of xml, fix problem with inputs and br tags caused by html which is not valid xml
This commit is contained in:
parent
88005a399b
commit
491a3e6125
|
@ -349,7 +349,7 @@ function convertHtmlToReact(node, context) {
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
function convertTemplateToReact(html, options) {
|
function convertTemplateToReact(html, options) {
|
||||||
var rootNode = cheerio.load(html, {lowerCaseTags: false, lowerCaseAttributeNames: false, xmlMode: true, withStartIndices: true});
|
var rootNode = cheerio.load(html, {lowerCaseTags: false, lowerCaseAttributeNames: false, xmlMode: false, withStartIndices: true});
|
||||||
options = _.defaults({}, options, defaultOptions);
|
options = _.defaults({}, options, defaultOptions);
|
||||||
var defines = {'react/addons': 'React', lodash: '_'};
|
var defines = {'react/addons': 'React', lodash: '_'};
|
||||||
var context = defaultContext(html, options);
|
var context = defaultContext(html, options);
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
<!doctype rt>
|
||||||
|
<div>
|
||||||
|
<input type="text" name="first">
|
||||||
|
<input type="text" name="second">
|
||||||
|
</div>
|
|
@ -0,0 +1,15 @@
|
||||||
|
define([
|
||||||
|
'react/addons',
|
||||||
|
'lodash'
|
||||||
|
], function (React, _) {
|
||||||
|
'use strict';
|
||||||
|
return function () {
|
||||||
|
return React.createElement('div', {}, React.createElement('input', {
|
||||||
|
'type': 'text',
|
||||||
|
'name': 'first'
|
||||||
|
}), React.createElement('input', {
|
||||||
|
'type': 'text',
|
||||||
|
'name': 'second'
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
});
|
|
@ -43,7 +43,7 @@ function errorEqual(err) {
|
||||||
}
|
}
|
||||||
|
|
||||||
test('conversion test', function (t) {
|
test('conversion test', function (t) {
|
||||||
var files = ['div.rt', 'test.rt', 'repeat.rt'];
|
var files = ['div.rt', 'test.rt', 'repeat.rt','inputs.rt'];
|
||||||
t.plan(files.length);
|
t.plan(files.length);
|
||||||
|
|
||||||
files.forEach(check);
|
files.forEach(check);
|
||||||
|
|
Loading…
Reference in New Issue