Skip to content

Commit 0eb4c3e

Browse files
committed
use jquery given element on $.each()
1 parent 9c02ceb commit 0eb4c3e

File tree

5 files changed

+9
-15
lines changed

5 files changed

+9
-15
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Kappa.js",
3-
"version": "2.0.0",
3+
"version": "2.0.2",
44
"homepage": "http://simulatedgreg.github.io/kappa.js/",
55
"authors": [
66
"Greg Holguin <[email protected]>"

dist/kappa.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,8 @@
9696
function replaceTextWithEmotes() {
9797
for (var emote in KappaJS.emotes) {
9898
if (KappaJS.emotes.hasOwnProperty(emote)) {
99-
$(self).each(function () {
100-
// NOTE: Transpiler bug
101-
// Next 2 selector should be `this`, but babel grab context of `replaceTextWithEmotes` function
102-
// Manually adjusted in build until futher notice.
103-
$(this).html($(this).html().replace(new RegExp('\\b' + emote + '\\b', 'g'), generateImgTag(KappaJS.emotes[emote], emote)));
99+
$(self).each(function (i, el) {
100+
$(el).html($(el).html().replace(new RegExp('\\b' + emote + '\\b', 'g'), generateImgTag(KappaJS.emotes[emote], emote)));
104101
});
105102
}
106103
}
@@ -115,4 +112,4 @@
115112
waitKappaJS();
116113
} else replaceTextWithEmotes();
117114
};
118-
})(jQuery);
115+
})(jQuery);

dist/kappa.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "kappa.js",
3-
"version": "2.0.0",
3+
"version": "2.0.2",
44
"description": "Kappa.js is a simple jQuery Plugin that can easily find text Twitch emotes and replace them with their respective emoticons. ",
55
"main": "dist/kappa.min.js",
66
"scripts": {

src/kappa.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,9 @@
104104
function replaceTextWithEmotes() {
105105
for (var emote in KappaJS.emotes) {
106106
if (KappaJS.emotes.hasOwnProperty(emote)) {
107-
$(self).each(() => {
108-
// NOTE: Transpiler bug
109-
// Next 2 selector should be `this`, but babel grab context of `replaceTextWithEmotes` function
110-
// Manually adjusted in build until futher notice.
111-
$(self).html(
112-
$(self).html().replace(
107+
$(self).each((i, el) => {
108+
$(el).html(
109+
$(el).html().replace(
113110
new RegExp('\\b' + emote + '\\b', 'g'),
114111
generateImgTag(KappaJS.emotes[emote], emote)
115112
)

0 commit comments

Comments
 (0)