Opened 9 years ago

Closed 8 years ago

#13166 closed defect (fixed)

[patch][ccla]dijit.form.ExpandingTextAreaMixin.resize might compute negative height throwing error under IE

Reported by: Patrick Ruzand Owned by: Douglas Hays
Priority: high Milestone: 1.7
Component: Dijit - Form Version:
Keywords: Cc: pruzand@…
Blocked By: Blocking:

Description

The issue is specific to IE, and happens when the TextArea? resize() is triggered. In some situation, the height value that is assigned to "textarea.style.height" can be negative, throwing an "invalid argument" error :

in dijit/form/_ExpandingTextAreaMixin.js, l.89 :

var currentHeight = textarea.style.height; if(!(/px/.test(currentHeight))){ [...] } var newH = parseInt(currentHeight) + textareaScrollHeight() -

textarea.clientHeight;

var newHpx = newH + "px"; if(newHpx != textarea.style.height){

textarea.rows = 1; textarea.style.height = newHpx; <<<<<<< error if newHpx is < 0

}

In my use case, the computed newH value is < 0, which gives the exception. I would say 'newH' should be checked against negative value.

Attachments (2)

13166.patch (2.8 KB) - added by Patrick Ruzand 9 years ago.
testcase + patch
13166.2.patch (1.9 KB) - added by Douglas Hays 9 years ago.
fix + testcase

Download all attachments as: .zip

Change History (5)

Changed 9 years ago by Patrick Ruzand

Attachment: 13166.patch added

testcase + patch

comment:1 Changed 9 years ago by Douglas Hays

Resolution: wontfix
Status: newclosed

While this prevents an exception, it does 2 bad things:
1) hides the fact that the web page needs to change to SimpleTextarea? since Textarea "owns" height
2) causes the textarea to be chopped off and scrollbars to appear

comment:2 Changed 9 years ago by Douglas Hays

Resolution: wontfix
Status: closedreopened

Setting minHeight in IE8 is also causing an exception

Changed 9 years ago by Douglas Hays

Attachment: 13166.2.patch added

fix + testcase

comment:3 Changed 8 years ago by Douglas Hays

Resolution: fixed
Status: reopenedclosed

(In [25465]) Fixes #13166. Check to make sure that height is not set to less than the scrollHeight. Added automated testcase.

Note: See TracTickets for help on using tickets.