Skip to content

Commit 77fc838

Browse files
committed
fix(is-icon-ligature): ignore whitespace characters (#1908)
1 parent 8c9f6c1 commit 77fc838

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

lib/commons/text/is-icon-ligature.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ text.isIconLigature = function(
7272
* │ │█│█│█│█│█│█│█│█│█│█│█│█│█│ │
7373
* └─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘
7474
*/
75-
const nodeValue = textVNode.actualNode.nodeValue;
75+
const nodeValue = textVNode.actualNode.nodeValue.trim();
7676

7777
// text with unicode or non-bmp letters cannot be ligature icons
7878
if (

test/commons/text/is-icon-ligature.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,13 @@ describe('text.isIconLigature', function() {
121121
}
122122
);
123123

124+
(fontApiSupport ? it : it.skip)('should trim the string', function() {
125+
var target = queryFixture(
126+
'<div id="target" style="font-family: Roboto"> fflu shot </div>'
127+
);
128+
assert.isFalse(isIconLigature(target.children[0]));
129+
});
130+
124131
(fontApiSupport ? it : it.skip)(
125132
'should return true for a font that has no character data',
126133
function() {

0 commit comments

Comments
 (0)