mirror of
https://github.com/twitter/twemoji.git
synced 2024-11-02 11:30:12 +00:00
Merge pull request #126 from twuttke/200D_minifier_protection
Alternate way to avoid using \u 200d
This commit is contained in:
commit
b2738a248e
@ -232,6 +232,9 @@ define(function () {
|
||||
// not JIT based, and old browsers / engines
|
||||
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
|
||||
rescaper = /[&<>'"]/g,
|
||||
|
||||
@ -316,7 +319,7 @@ define(function () {
|
||||
*/
|
||||
function grabTheRightIcon(rawText) {
|
||||
// if variant is present as \uFE0F
|
||||
return toCodePoint(rawText.indexOf('\u200D') < 0 ?
|
||||
return toCodePoint(rawText.indexOf(U200D) < 0 ?
|
||||
rawText.replace(UFE0Fg, '') :
|
||||
rawText
|
||||
);
|
||||
|
@ -231,6 +231,9 @@ var twemoji = (function (
|
||||
// not JIT based, and old browsers / engines
|
||||
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
|
||||
rescaper = /[&<>'"]/g,
|
||||
|
||||
@ -315,7 +318,7 @@ var twemoji = (function (
|
||||
*/
|
||||
function grabTheRightIcon(rawText) {
|
||||
// if variant is present as \uFE0F
|
||||
return toCodePoint(rawText.indexOf('\u200D') < 0 ?
|
||||
return toCodePoint(rawText.indexOf(U200D) < 0 ?
|
||||
rawText.replace(UFE0Fg, '') :
|
||||
rawText
|
||||
);
|
||||
|
2
2/twemoji.min.js
vendored
2
2/twemoji.min.js
vendored
File diff suppressed because one or more lines are too long
@ -232,6 +232,9 @@ var twemoji = (function (
|
||||
// not JIT based, and old browsers / engines
|
||||
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
|
||||
rescaper = /[&<>'"]/g,
|
||||
|
||||
@ -316,7 +319,7 @@ var twemoji = (function (
|
||||
*/
|
||||
function grabTheRightIcon(rawText) {
|
||||
// if variant is present as \uFE0F
|
||||
return toCodePoint(rawText.indexOf('\u200D') < 0 ?
|
||||
return toCodePoint(rawText.indexOf(U200D) < 0 ?
|
||||
rawText.replace(UFE0Fg, '') :
|
||||
rawText
|
||||
);
|
||||
|
@ -45,7 +45,7 @@ require('child_process').spawn(
|
||||
fs.writeFileSync(
|
||||
file('twemoji.min.js'),
|
||||
'/*! Copyright Twitter Inc. and other contributors. Licensed under MIT */\n' +
|
||||
fs.readFileSync(file('twemoji.tmp.js')).toString().replace(/("|')\u200D\1/g, '$1\\u200D$1')
|
||||
fs.readFileSync(file('twemoji.tmp.js'))
|
||||
);
|
||||
fs.unlink(file('twemoji.tmp.js'));
|
||||
// gzip -c twemoji.min.js | wc -c
|
||||
|
@ -647,6 +647,9 @@ function createTwemoji(re) {
|
||||
// not JIT based, and old browsers / engines
|
||||
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
|
||||
rescaper = /[&<>'"]/g,
|
||||
|
||||
@ -731,7 +734,7 @@ function createTwemoji(re) {
|
||||
*/
|
||||
function grabTheRightIcon(rawText) {
|
||||
// if variant is present as \uFE0F
|
||||
return toCodePoint(rawText.indexOf('\u200D') < 0 ?
|
||||
return toCodePoint(rawText.indexOf(U200D) < 0 ?
|
||||
rawText.replace(UFE0Fg, '') :
|
||||
rawText
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user