Skip to content

Commit 0fcda38

Browse files
authored
fix(framework): strip whitespaces around < and > (#1623)
1 parent 45a18c3 commit 0fcda38

File tree

8 files changed

+23
-25
lines changed

8 files changed

+23
-25
lines changed

packages/main/src/DurationPickerPopover.hbs

-1
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,4 @@
4545
<ui5-button id="submit" design="Emphasized" @click="{{submitPickers}}">{{submitButtonLabel}}</ui5-button>
4646
<ui5-button id="close" design="Transparent" @click="{{togglePicker}}">{{cancelButtonLabel}}</ui5-button>
4747
</div>
48-
{{!-- <div>hi</div> --}}
4948
</ui5-responsive-popover>

packages/main/src/List.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ const metadata = {
269269
/**
270270
* @class
271271
*
272-
* <h3 class="comment-api-title"> Overview </h3>
272+
* <h3 class="comment-api-title">Overview</h3>
273273
*
274274
* The <code>ui5-list</code> component allows displaying a list of items, advanced keyboard
275275
* handling support for navigating between items, and predefined modes to improve the development efficiency.

packages/main/src/TextArea.hbs

+1-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@
1111
{{#each _mirrorText}}
1212
{{this.text}}
1313

14-
{{#unless this.last}}
15-
<br/>
16-
{{/unless}}
14+
<br />
1715
{{/each}}
1816
</div>
1917
{{/if}}

packages/main/src/TextArea.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -403,14 +403,14 @@ class TextArea extends UI5Element {
403403
}
404404

405405
_oninput(event) {
406-
const nativeTextarea = this.getInputDomRef();
406+
const nativeTextArea = this.getInputDomRef();
407407

408408
/* skip calling change event when an textarea with a placeholder is focused on IE
409409
- value of the host and the internal textarea should be different in case of actual input
410410
- input is called when a key is pressed => keyup should not be called yet
411411
*/
412-
const skipFiring = (this.getInputDomRef().value === this.value) && isIE() && !this._keyDown && !!this.placeholder;
413-
if (event.target === nativeTextarea) {
412+
const skipFiring = (nativeTextArea.value === this.value) && isIE() && !this._keyDown && !!this.placeholder;
413+
if (event.target === nativeTextArea) {
414414
// stop the native event, as the semantic "input" would be fired.
415415
event.stopImmediatePropagation();
416416
}
@@ -419,7 +419,7 @@ class TextArea extends UI5Element {
419419
return;
420420
}
421421

422-
this.value = nativeTextarea.value;
422+
this.value = nativeTextArea.value;
423423
this.fireEvent("input", {});
424424

425425
// Angular two way data binding
@@ -456,7 +456,7 @@ class TextArea extends UI5Element {
456456
}
457457

458458
_tokenizeText(value) {
459-
const tokenizedText = value.replace(/&/gm, "&amp;").replace(/"/gm, "&quot;").replace(/"/gm, "&#39;").replace(/</gm, "&lt;")
459+
const tokenizedText = value.replace(/&/gm, "&amp;").replace(/"/gm, "&quot;").replace(/'/gm, "&apos;").replace(/</gm, "&lt;")
460460
.replace(/>/gm, "&gt;")
461461
.split("\n");
462462

packages/main/src/WheelSlider.hbs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
@wheel="{{_handleWheel}}"
1515
>
1616
<div class="ui5-wheelslider-header-block">
17-
<div id="{{this._id}}--label" class="ui5-wheelslider-label"> {{label}}</div>
17+
<div id="{{this._id}}--label" class="ui5-wheelslider-label">{{label}}</div>
1818
<div class="ui5-wheelslider-invisible-text"></div>
1919
<ui5-button class="ui5-wheelslider-arrow" icon="navigation-up-arrow" @click={{_onArrowUp}} tabindex="-1"></ui5-button>
2020
</div>

packages/main/test/pages/TextArea.html

+1-12
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">
66
<meta charset="utf-8">
77

8-
<title>Playground</title>
8+
<title>TextArea</title>
99
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
1010
<meta http-equiv="X-UA-Compatible" content="IE=edge">
1111
<meta charset="utf-8">
@@ -30,13 +30,6 @@
3030
margin: 0;
3131
}
3232

33-
.header {
34-
display: flex;
35-
justify-content: center;
36-
height: 3rem;
37-
background: #3f5161;
38-
}
39-
4033
.group {
4134
padding: 1rem;
4235
}
@@ -66,10 +59,6 @@
6659

6760
<body style="background-color: var(--sapBackgroundColor);">
6861

69-
<header class="header">
70-
<ui5-title class="header-title">Evoground</ui5-title>
71-
</header>
72-
7362
<section class="group">
7463
<ui5-title>Value State Message</ui5-title>
7564
<br>

packages/main/test/specs/TextArea.spec.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,14 @@ describe("when enabled", () => {
138138
const textAreaInner = browser.$("#eight-rows-textarea").shadow$("textarea");
139139

140140
const initialSize = textArea.getSize();
141-
textAreaInner.setValue(`1\n2\n3\n4\n5\n6\n7\n8`);
141+
textAreaInner.setValue(`1\n`);
142+
textAreaInner.setValue(`2\n`);
143+
textAreaInner.setValue(`3\n`);
144+
textAreaInner.setValue(`4\n`);
145+
textAreaInner.setValue(`5\n`);
146+
textAreaInner.setValue(`6\n`);
147+
textAreaInner.setValue(`7\n`);
148+
textAreaInner.setValue(`8`);
142149

143150
const sizeBeforeGrow = textArea.getSize();
144151
assert.strictEqual(initialSize.height, sizeBeforeGrow.height, "TextArea should not grow before it reaches its 8th line");

packages/tools/lib/hbs2lit/src/compiler.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@ const includesReplacer = require("./includesReplacer");
55
const svgProcessor = require("./svgProcessor");
66

77
const removeWhiteSpaces = (source) => {
8-
return source.replace(/\n+/g, "").replace(/\s+</g, "<").replace(/}}\s+{{/g, "}}{{").replace(/\t+/g, " ");
8+
return source
9+
.replace(/\n+/g, "")
10+
.replace(/\s*<\s*/g, "<")
11+
.replace(/\s*>\s*/g, ">")
12+
.replace(/}}\s+{{/g, "}}{{")
13+
.replace(/\t+/g, " ");
914
};
1015

1116
const compileString = async (sInput, config) => {

0 commit comments

Comments
 (0)