1
0
mirror of https://github.com/twitter/twemoji.git synced 2024-10-01 12:24:23 +00:00

Use U200D var

This commit is contained in:
Tom Wuttke 2016-03-02 08:43:56 -08:00
parent ba0f4e7847
commit 0bb11e6ec5
5 changed files with 17 additions and 9 deletions

View File

@ -232,6 +232,9 @@ define(function () {
// not JIT based, and old browsers / engines // not JIT based, and old browsers / engines
UFE0Fg = /\uFE0F/g, UFE0Fg = /\uFE0F/g,
// avoid using a string literal like '\u200D' here because minifiers expand it inline
U200D = String.fromCharCode(0x200D),
// used to find HTML special chars in attributes // used to find HTML special chars in attributes
rescaper = /[&<>'"]/g, rescaper = /[&<>'"]/g,
@ -316,8 +319,7 @@ define(function () {
*/ */
function grabTheRightIcon(rawText) { function grabTheRightIcon(rawText) {
// if variant is present as \uFE0F // if variant is present as \uFE0F
// (avoid using a string literal for '\u200D' or minifiers may inject the raw value) return toCodePoint(rawText.indexOf(U200D) < 0 ?
return toCodePoint(rawText.indexOf(String.fromCharCode(0x200D)) < 0 ?
rawText.replace(UFE0Fg, '') : rawText.replace(UFE0Fg, '') :
rawText rawText
); );

View File

@ -231,6 +231,9 @@ var twemoji = (function (
// not JIT based, and old browsers / engines // not JIT based, and old browsers / engines
UFE0Fg = /\uFE0F/g, UFE0Fg = /\uFE0F/g,
// avoid using a string literal like '\u200D' here because minifiers expand it inline
U200D = String.fromCharCode(0x200D),
// used to find HTML special chars in attributes // used to find HTML special chars in attributes
rescaper = /[&<>'"]/g, rescaper = /[&<>'"]/g,
@ -315,8 +318,7 @@ var twemoji = (function (
*/ */
function grabTheRightIcon(rawText) { function grabTheRightIcon(rawText) {
// if variant is present as \uFE0F // if variant is present as \uFE0F
// (avoid using a string literal for '\u200D' or minifiers may inject the raw value) return toCodePoint(rawText.indexOf(U200D) < 0 ?
return toCodePoint(rawText.indexOf(String.fromCharCode(0x200D)) < 0 ?
rawText.replace(UFE0Fg, '') : rawText.replace(UFE0Fg, '') :
rawText rawText
); );

2
2/twemoji.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -232,6 +232,9 @@ var twemoji = (function (
// not JIT based, and old browsers / engines // not JIT based, and old browsers / engines
UFE0Fg = /\uFE0F/g, UFE0Fg = /\uFE0F/g,
// avoid using a string literal like '\u200D' here because minifiers expand it inline
U200D = String.fromCharCode(0x200D),
// used to find HTML special chars in attributes // used to find HTML special chars in attributes
rescaper = /[&<>'"]/g, rescaper = /[&<>'"]/g,
@ -316,8 +319,7 @@ var twemoji = (function (
*/ */
function grabTheRightIcon(rawText) { function grabTheRightIcon(rawText) {
// if variant is present as \uFE0F // if variant is present as \uFE0F
// (avoid using a string literal for '\u200D' or minifiers may inject the raw value) return toCodePoint(rawText.indexOf(U200D) < 0 ?
return toCodePoint(rawText.indexOf(String.fromCharCode(0x200D)) < 0 ?
rawText.replace(UFE0Fg, '') : rawText.replace(UFE0Fg, '') :
rawText rawText
); );

View File

@ -647,6 +647,9 @@ function createTwemoji(re) {
// not JIT based, and old browsers / engines // not JIT based, and old browsers / engines
UFE0Fg = /\uFE0F/g, UFE0Fg = /\uFE0F/g,
// avoid using a string literal like '\u200D' here because minifiers expand it inline
U200D = String.fromCharCode(0x200D),
// used to find HTML special chars in attributes // used to find HTML special chars in attributes
rescaper = /[&<>'"]/g, rescaper = /[&<>'"]/g,
@ -731,8 +734,7 @@ function createTwemoji(re) {
*/ */
function grabTheRightIcon(rawText) { function grabTheRightIcon(rawText) {
// if variant is present as \uFE0F // if variant is present as \uFE0F
// (avoid using a string literal for '\u200D' or minifiers may inject the raw value) return toCodePoint(rawText.indexOf(U200D) < 0 ?
return toCodePoint(rawText.indexOf(String.fromCharCode(0x200D)) < 0 ?
rawText.replace(UFE0Fg, '') : rawText.replace(UFE0Fg, '') :
rawText rawText
); );