Skip to content

Commit d001731

Browse files
committed
fix bug
1 parent 36d22d6 commit d001731

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

jquery.HTMLplus.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,9 @@
455455
var setHeight=function(){
456456
if(!$mirror){
457457
$mirror=$('<div class="autogrow-mirror"></div>').css({
458-
display:'none',
458+
display:'block',
459+
position:'absolute',
460+
visibility:'hidden',
459461
wordWrap:'break-word',
460462
padding:$el.css('padding'),
461463
width:$el.css('width'),
@@ -467,7 +469,7 @@
467469
$mirror.insertAfter($el);
468470
$el.css({overflow:'hidden',minHeight:$el.attr('rows')+"em"});
469471
}
470-
$mirror.html(String($el.val()).replace(/&/g,'&amp;').replace(/"/g,'&quot;').replace(/'/g,'&#39;').replace(/</g,'&lt;').replace(/>/g,'&gt;').replace(/\n/g,'<br />')+'.<br/>.');
472+
$mirror.html($el.val().toString().replace(/&/g,'&amp;').replace(/"/g,'&quot;').replace(/'/g,'&#39;').replace(/</g,'&lt;').replace(/>/g,'&gt;').replace(/\n/g,'<br />')+'.<br/>.<br/>.');
471473
$el.height($mirror.height());
472474
};
473475
if($el.hasClass(x+'autoheight')) setHeight();
@@ -480,8 +482,11 @@
480482
}
481483
if(maxLength || lbox){
482484
$el.keypress(function(e){
483-
var c=String.fromCharCode(e.charCode===undefined ? e.keyCode : e.charCode);
484-
return (e.ctrlKey || e.metaKey || c==='\u0000' || $el.val().length < maxLength);
485+
if(maxLength){
486+
var c=String.fromCharCode(e.charCode===undefined ? e.keyCode : e.charCode);
487+
return (e.ctrlKey || e.metaKey || c==='\u0000' || $el.val().length < maxLength);
488+
}
489+
else return true;
485490
}).keyup(function(){
486491
var txt = $el.val();
487492
var t=(options.lb==='\n') ? '~' : '~~';

0 commit comments

Comments
 (0)