Plugins

The plugins site is currently in development.

We've been looking to provide a higher-quality, spam-free experience at the plugins site for some time, and a major error on our part forced us to shut down the current site before we could put the new one in place. We are developing a new site, and you can follow along with its development on GitHub. For more information about this transition, including steps you can take as a plugin author to prepare, please read our post about what's going on.

html markup in textarea can cause size to be way off


Project:Auto Growing Textareas
Version:1.2.2
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

If you have html markup in the textarea - it gets rendered into the dummy div as is, so for example if you have image tags in your text it could potentially render the image in the dummy div causing your textarea to be much bigger than it should be. Simple fix is to escape all html tags. Around line 101 change to:

var html = this.textarea.val().replace(/</g, '&lt;');
var html = html.replace(/>/g, '&gt;');
var html = html.replace(/\n/g, '<br>new');

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

#1

I would suggest something slightly more complicated, but still based on your idea and much more correct than simply stripping the tags. patch attached.

AttachmentSize
jquery.autogrow-1.2.2-fixstriptags.diff_.txt 1.01 KB

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.