Skip to content

Commit 33c6b78

Browse files
authored
Fixing atom to capitalize text (#13792)
* Fixing atom to capitalize text Credit to @whimboo Fixes #13779 * Adding a test
1 parent d142ce0 commit 33c6b78

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

javascript/atoms/dom.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1173,7 +1173,7 @@ bot.dom.appendVisibleTextLinesFromTextNode_ = function(textNode, lines,
11731173

11741174
if (textTransform == 'capitalize') {
11751175
// the unicode regex ending with /gu does not work in IE
1176-
var re = goog.userAgent.IE ? /(^|\s|\b)(\S)/g : /(^|[^\d\p{L}\p{S}])([\p{Ll}|\p{S}])/gu;
1176+
var re = goog.userAgent.IE ? /(^|\s|\b)(\S)/g : /(^|\s|\b)(\S)/gu;
11771177
text = text.replace(re, function() {
11781178
return arguments[1] + arguments[2].toUpperCase();
11791179
});

javascript/atoms/test/text_test.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,8 @@
280280
assertEquals('(This) “Is” [A] –Short– -Test- «For» *The* _Css_ ¿Capitalize? ?¡Transfor', text);
281281
text = getVisibleTextByElementId("capitalized-8");
282282
assertEquals('The Dutch Word: "Ijsland" Starts With A Digraph', text);
283+
text = getVisibleTextByElementId("capitalized-9");
284+
assertEquals('Test_text', text);
283285
}
284286

285287
function getVisibleTextByElementId(id) {
@@ -430,6 +432,7 @@
430432
<a id="capitalized-6" style="text-transform: capitalize">ⓐⓑⓒ (ⓓⓔⓕ) —ⓖⓗⓘ— ⓙkl</a><br/>
431433
<a id="capitalized-7" style="text-transform: capitalize">(this) “is” [a] –short– -test- «for» *the* _css_ ¿capitalize? ?¡transfor</a><br/>
432434
<a id="capitalized-8" style="text-transform: capitalize">The Dutch word: "ijsland" starts with a digraph</a><br/>
435+
<a id="capitalized-9" style="text-transform: capitalize">test_text</a><br/>
433436
</div>
434437

435438
</body>

0 commit comments

Comments
 (0)