未验证 提交 c780ebab 编写于 作者: A Alex Dima

Use   instead of   to support XHTML (fixes microsoft/monaco-editor#1492)

上级 29a2c568
......@@ -171,7 +171,7 @@ export class InputBox extends Widget {
this.maxHeight = typeof this.options.flexibleMaxHeight === 'number' ? this.options.flexibleMaxHeight : Number.POSITIVE_INFINITY;
this.mirror = dom.append(wrapper, $('div.mirror'));
this.mirror.innerHTML = ' ';
this.mirror.innerHTML = ' ';
this.scrollableElement = new ScrollableElement(this.element, { vertical: ScrollbarVisibility.Auto });
......@@ -529,7 +529,7 @@ export class InputBox extends Widget {
if (mirrorTextContent) {
this.mirror.textContent = value + suffix;
} else {
this.mirror.innerHTML = ' ';
this.mirror.innerHTML = ' ';
}
this.layout();
......
......@@ -124,7 +124,7 @@ class DomCharWidthReader {
private static _render(testElement: HTMLElement, request: CharWidthRequest): void {
if (request.chr === ' ') {
let htmlString = ' ';
let htmlString = ' ';
// Repeat character 256 (2^8) times
for (let i = 0; i < 8; i++) {
htmlString += htmlString;
......
......@@ -695,7 +695,7 @@ export class DiffReview extends Disposable {
if (originalLine !== 0) {
originalLineNumber.appendChild(document.createTextNode(String(originalLine)));
} else {
originalLineNumber.innerHTML = '&nbsp;';
originalLineNumber.innerHTML = '&#160;';
}
cell.appendChild(originalLineNumber);
......@@ -707,13 +707,13 @@ export class DiffReview extends Disposable {
if (modifiedLine !== 0) {
modifiedLineNumber.appendChild(document.createTextNode(String(modifiedLine)));
} else {
modifiedLineNumber.innerHTML = '&nbsp;';
modifiedLineNumber.innerHTML = '&#160;';
}
cell.appendChild(modifiedLineNumber);
const spacer = document.createElement('span');
spacer.className = spacerClassName;
spacer.innerHTML = '&nbsp;&nbsp;';
spacer.innerHTML = '&#160;&#160;';
cell.appendChild(spacer);
let lineContent: string;
......
......@@ -46,7 +46,7 @@ export function tokenizeLineToHTML(text: string, viewLineTokens: IViewLineTokens
let insertSpacesCount = tabSize - (charIndex + tabsCharDelta) % tabSize;
tabsCharDelta += insertSpacesCount - 1;
while (insertSpacesCount > 0) {
partContent += useNbsp ? '&nbsp;' : ' ';
partContent += useNbsp ? '&#160;' : ' ';
insertSpacesCount--;
}
break;
......@@ -78,7 +78,7 @@ export function tokenizeLineToHTML(text: string, viewLineTokens: IViewLineTokens
break;
case CharCode.Space:
partContent += useNbsp ? '&nbsp;' : ' ';
partContent += useNbsp ? '&#160;' : ' ';
break;
default:
......
......@@ -96,7 +96,7 @@ class CodeLensContentWidget implements editorBrowser.IContentWidget {
innerHtml += `<span>${title}</span>`;
}
if (i + 1 < lenses.length) {
innerHtml += '<span>&nbsp;|&nbsp;</span>';
innerHtml += '<span>&#160;|&#160;</span>';
}
}
}
......@@ -108,7 +108,7 @@ class CodeLensContentWidget implements editorBrowser.IContentWidget {
} else {
// symbols and commands
if (!innerHtml) {
innerHtml = '&nbsp;';
innerHtml = '&#160;';
}
this._domNode.innerHTML = innerHtml;
if (this._isEmpty && animate) {
......
......@@ -109,9 +109,9 @@ suite('Editor Modes - textToHtmlTokenizer', () => {
[
'<div>',
'<span style="color: #ff0000;font-style: italic;font-weight: bold;">Ciao</span>',
'<span style="color: #000000;">&nbsp;</span>',
'<span style="color: #000000;">&#160;</span>',
'<span style="color: #00ff00;">hello</span>',
'<span style="color: #000000;">&nbsp;</span>',
'<span style="color: #000000;">&#160;</span>',
'<span style="color: #0000ff;text-decoration: underline;">world!</span>',
'</div>'
].join('')
......@@ -122,9 +122,9 @@ suite('Editor Modes - textToHtmlTokenizer', () => {
[
'<div>',
'<span style="color: #ff0000;font-style: italic;font-weight: bold;">Ciao</span>',
'<span style="color: #000000;">&nbsp;</span>',
'<span style="color: #000000;">&#160;</span>',
'<span style="color: #00ff00;">hello</span>',
'<span style="color: #000000;">&nbsp;</span>',
'<span style="color: #000000;">&#160;</span>',
'<span style="color: #0000ff;text-decoration: underline;">w</span>',
'</div>'
].join('')
......@@ -135,9 +135,9 @@ suite('Editor Modes - textToHtmlTokenizer', () => {
[
'<div>',
'<span style="color: #ff0000;font-style: italic;font-weight: bold;">Ciao</span>',
'<span style="color: #000000;">&nbsp;</span>',
'<span style="color: #000000;">&#160;</span>',
'<span style="color: #00ff00;">hello</span>',
'<span style="color: #000000;">&nbsp;</span>',
'<span style="color: #000000;">&#160;</span>',
'</div>'
].join('')
);
......@@ -147,9 +147,9 @@ suite('Editor Modes - textToHtmlTokenizer', () => {
[
'<div>',
'<span style="color: #ff0000;font-style: italic;font-weight: bold;">iao</span>',
'<span style="color: #000000;">&nbsp;</span>',
'<span style="color: #000000;">&#160;</span>',
'<span style="color: #00ff00;">hello</span>',
'<span style="color: #000000;">&nbsp;</span>',
'<span style="color: #000000;">&#160;</span>',
'</div>'
].join('')
);
......@@ -158,9 +158,9 @@ suite('Editor Modes - textToHtmlTokenizer', () => {
tokenizeLineToHTML(text, lineTokens, colorMap, 4, 11, 4, true),
[
'<div>',
'<span style="color: #000000;">&nbsp;</span>',
'<span style="color: #000000;">&#160;</span>',
'<span style="color: #00ff00;">hello</span>',
'<span style="color: #000000;">&nbsp;</span>',
'<span style="color: #000000;">&#160;</span>',
'</div>'
].join('')
);
......@@ -170,7 +170,7 @@ suite('Editor Modes - textToHtmlTokenizer', () => {
[
'<div>',
'<span style="color: #00ff00;">hello</span>',
'<span style="color: #000000;">&nbsp;</span>',
'<span style="color: #000000;">&#160;</span>',
'</div>'
].join('')
);
......@@ -241,11 +241,11 @@ suite('Editor Modes - textToHtmlTokenizer', () => {
tokenizeLineToHTML(text, lineTokens, colorMap, 0, 21, 4, true),
[
'<div>',
'<span style="color: #000000;">&nbsp;&nbsp;</span>',
'<span style="color: #000000;">&#160;&#160;</span>',
'<span style="color: #ff0000;font-style: italic;font-weight: bold;">Ciao</span>',
'<span style="color: #000000;">&nbsp;&nbsp;&nbsp;</span>',
'<span style="color: #000000;">&#160;&#160;&#160;</span>',
'<span style="color: #00ff00;">hello</span>',
'<span style="color: #000000;">&nbsp;</span>',
'<span style="color: #000000;">&#160;</span>',
'<span style="color: #0000ff;text-decoration: underline;">world!</span>',
'</div>'
].join('')
......@@ -255,11 +255,11 @@ suite('Editor Modes - textToHtmlTokenizer', () => {
tokenizeLineToHTML(text, lineTokens, colorMap, 0, 17, 4, true),
[
'<div>',
'<span style="color: #000000;">&nbsp;&nbsp;</span>',
'<span style="color: #000000;">&#160;&#160;</span>',
'<span style="color: #ff0000;font-style: italic;font-weight: bold;">Ciao</span>',
'<span style="color: #000000;">&nbsp;&nbsp;&nbsp;</span>',
'<span style="color: #000000;">&#160;&#160;&#160;</span>',
'<span style="color: #00ff00;">hello</span>',
'<span style="color: #000000;">&nbsp;</span>',
'<span style="color: #000000;">&#160;</span>',
'<span style="color: #0000ff;text-decoration: underline;">wo</span>',
'</div>'
].join('')
......@@ -269,7 +269,7 @@ suite('Editor Modes - textToHtmlTokenizer', () => {
tokenizeLineToHTML(text, lineTokens, colorMap, 0, 3, 4, true),
[
'<div>',
'<span style="color: #000000;">&nbsp;&nbsp;</span>',
'<span style="color: #000000;">&#160;&#160;</span>',
'<span style="color: #ff0000;font-style: italic;font-weight: bold;">C</span>',
'</div>'
].join('')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册