Bugfix for #3024 - escaping HTML tags
This commit is contained in:
parent
95c19159f8
commit
e698d81f9f
@ -172,7 +172,7 @@ angular.module('OpenSlidesApp.motions.diff', ['OpenSlidesApp.motions.lineNumberi
|
|||||||
|
|
||||||
this._serializeDom = function(node, stripLineNumbers) {
|
this._serializeDom = function(node, stripLineNumbers) {
|
||||||
if (node.nodeType == TEXT_NODE) {
|
if (node.nodeType == TEXT_NODE) {
|
||||||
return node.nodeValue;
|
return node.nodeValue.replace(/</g, "<").replace(/>/g, ">");
|
||||||
}
|
}
|
||||||
if (stripLineNumbers && (
|
if (stripLineNumbers && (
|
||||||
lineNumberingService._isOsLineNumberNode(node) || lineNumberingService._isOsLineBreakNode(node))) {
|
lineNumberingService._isOsLineNumberNode(node) || lineNumberingService._isOsLineBreakNode(node))) {
|
||||||
@ -193,7 +193,7 @@ angular.module('OpenSlidesApp.motions.diff', ['OpenSlidesApp.motions.lineNumberi
|
|||||||
var html = this._serializeTag(node);
|
var html = this._serializeTag(node);
|
||||||
for (var i = 0; i < node.childNodes.length; i++) {
|
for (var i = 0; i < node.childNodes.length; i++) {
|
||||||
if (node.childNodes[i].nodeType == TEXT_NODE) {
|
if (node.childNodes[i].nodeType == TEXT_NODE) {
|
||||||
html += node.childNodes[i].nodeValue;
|
html += node.childNodes[i].nodeValue.replace(/</g, "<").replace(/>/g, ">");
|
||||||
} else if (!stripLineNumbers || (!lineNumberingService._isOsLineNumberNode(node.childNodes[i]) && !lineNumberingService._isOsLineBreakNode(node.childNodes[i]))) {
|
} else if (!stripLineNumbers || (!lineNumberingService._isOsLineNumberNode(node.childNodes[i]) && !lineNumberingService._isOsLineBreakNode(node.childNodes[i]))) {
|
||||||
html += this._serializeDom(node.childNodes[i], stripLineNumbers);
|
html += this._serializeDom(node.childNodes[i], stripLineNumbers);
|
||||||
}
|
}
|
||||||
|
@ -188,6 +188,12 @@ describe('linenumbering', function () {
|
|||||||
expect(diff.outerContextStart).toBe('<OL start="3">');
|
expect(diff.outerContextStart).toBe('<OL start="3">');
|
||||||
expect(diff.outerContextEnd).toBe('</OL>');
|
expect(diff.outerContextEnd).toBe('</OL>');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('escapes text resembling HTML-Tags', function () {
|
||||||
|
var inHtml = '<h2>' + noMarkup(1) + 'Looks like a <p> tag </p></h2><p>' + noMarkup(2) + 'Another line</p>';
|
||||||
|
var diff = diffService.extractRangeByLineNumbers(inHtml, 1, 2, true);
|
||||||
|
expect(diff.html).toBe('<H2>Looks like a <p> tag </p></H2>');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('merging two sections', function () {
|
describe('merging two sections', function () {
|
||||||
|
Loading…
Reference in New Issue
Block a user