Skip to content

Commit 381fb61

Browse files
committed
Merge pull request #41 from EloB/fix/namespaced-classes
Fixed namespaced classes and removed overflow hidden on root element
2 parents 16283d2 + b646d6a commit 381fb61

File tree

4 files changed

+15
-18
lines changed

4 files changed

+15
-18
lines changed

jquery.highlighttextarea.css

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@
66

77
.highlightTextarea {
88
position:relative;
9-
overflow:hidden;
109
}
11-
.highlightTextarea .container {
10+
.highlightTextarea .highlightTextarea-container {
1211
position:absolute;
1312
margin:0;
1413
overflow:hidden;
1514
}
16-
.highlightTextarea .highlighter {
15+
.highlightTextarea .highlightTextarea-highlighter {
1716
position:relative;
1817
border:none;
1918
padding:0;
@@ -24,7 +23,7 @@
2423
white-space:pre-wrap;
2524
word-wrap:break-word;
2625
}
27-
.highlightTextarea.debug .highlighter {
26+
.highlightTextarea.debug .highlightTextarea-highlighter {
2827
color:#f00;
2928
border:1px solid #f00;
3029
margin:-1px;

jquery.highlighttextarea.js

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
// build HTML
2020
this.$el = $el;
2121

22-
this.$el.wrap('<div class=highlightTextarea></div>');
22+
this.$el.wrap('<div class="highlightTextarea"></div>');
2323
this.$main = this.$el.parent();
2424

25-
this.$main.prepend('<div class=container><div class=highlighter></div></div>');
25+
this.$main.prepend('<div class="highlightTextarea-container"><div class="highlightTextarea-highlighter"></div></div>');
2626
this.$container = this.$main.children().first();
2727
this.$highlighter = this.$container.children();
2828

@@ -184,28 +184,28 @@
184184

185185
// add triggers to textarea
186186
this.$el.on({
187-
'input.highlighter': Utilities.throttle(function() {
187+
'input.highlightTextarea': Utilities.throttle(function() {
188188
this.highlight();
189189
}, 100, this),
190190

191-
'resize.highlighter': Utilities.throttle(function() {
191+
'resize.highlightTextarea': Utilities.throttle(function() {
192192
this.updateSizePosition(true);
193193
}, 50, this),
194194

195-
'scroll.highlighter select.highlighter': Utilities.throttle(function() {
195+
'scroll.highlightTextarea select.highlightTextarea': Utilities.throttle(function() {
196196
this.updateSizePosition();
197197
}, 50, this)
198198
});
199199

200200
if (this.isInput) {
201201
this.$el.on({
202202
// Prevent Cmd-Left Arrow and Cmd-Right Arrow on Mac strange behavior
203-
'keydown.highlighter keypress.highlighter keyup.highlighter': function() {
203+
'keydown.highlightTextarea keypress.highlightTextarea keyup.highlightTextarea': function() {
204204
setTimeout($.proxy(that.updateSizePosition, that), 1);
205205
},
206206

207207
// Force Chrome behavior on all browsers: reset input position on blur
208-
'blur.highlighter': function() {
208+
'blur.highlightTextarea': function() {
209209
this.value = this.value;
210210
this.scrollLeft = 0;
211211
that.updateSizePosition.call(that);
@@ -223,10 +223,8 @@
223223
}
224224
this.active = false;
225225

226-
this.$highlighter.off('click.highlighter');
227-
this.$el.off('input.highlighter resize.highlighter scroll.highlighter' +
228-
' keydown.highlighter keypress.highlighter keyup.highlighter' +
229-
' select.highlighter blur.highlighter');
226+
this.$highlighter.off('.highlightTextarea');
227+
this.$el.off('.highlightTextarea');
230228
};
231229

232230
/*
@@ -583,4 +581,4 @@
583581
}
584582
});
585583
};
586-
}(jQuery));
584+
}(window.jQuery || window.Zepto));

jquery.highlighttextarea.min.css

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

jquery.highlighttextarea.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.

0 commit comments

Comments
 (0)