[Dojo-checkins] [dojo] #4979: Textarea: Refactor to be much simpler.

dojo trac at dojotoolkit.org
Thu Nov 1 21:47:35 UTC 2007


#4979: Textarea: Refactor to be much simpler.
-------------------------+--------------------------------------------------
 Reporter:  rcoup        |        Owner:         
     Type:  enhancement  |       Status:  closed 
 Priority:  normal       |    Milestone:         
Component:  Dijit        |      Version:  0.9    
 Severity:  normal       |   Resolution:  invalid
 Keywords:  4alex        |  
-------------------------+--------------------------------------------------
Changes (by bill):

  * status:  new => closed
  * resolution:  => invalid

Comment:

 Well, yes, when FF3 is released (or at least, when we desupport FF2), we
 will remove the iframe code and that will make things a lot simpler, and
 addresses the first 4 point from above:
  * It uses an IFRAME or ContentEditable DIV depending on browser.
  * That means lots of accessibility/event/focus-handling code wrt the rest
 of the page.
  * Nearly every method is a big `if-else` block on whether its using an
 IFRAME or a DIV.
  * The DIV/IFRAME is written as an inline conditional TemplateString with
 inline javascript via `<script>` tags.

 I filed #4988 to help us remember that.

 But even removing the iframe code still leaves the final issue from the
 original post:

  * (Textarea) processes ''some'' HTML tags via ~15 uncommented regexes, to
 replace `<br/>, <p>, <div>, &gt;`, etc.

 IIRC, the problems with using a real <textarea> and resizing it via JS
 were:
  * FF2 doesn't shrink area when text is removed (hopefully that problem
 goes away with FF3 and !ContentEditable <div>s?)
  * problem detecting cut/paste into the textarea, via either ctrl-v or the
 right-click/Paste menu item.  Need to resize text area when someone pastes
 it, or cuts out of it.  Also when someone deletes a big chunk of text,
 either via the delete key or perhaps via a context menu (so I guess you
 would need a timer monitoring the textarea's contents?)
  * We have to detect when people type Japanese or another Asian language,
 not just English.  Not sure if compositionend works on IE. See related
 bug#4743.
  * need to detect screen resize, and also when user adjusts browser's font
 size, making it bigger or smaller, because both those events could affect
 the length of the textarea (see related bug #4560)

 So anyway, it seems much more complicated than you were thinking.  You are
 welcome to post an alternate version that uses a <textarea> node, and if
 it's simpler (and addresses all the points from above) will be happy to
 replace the current version, but  without a working example I have to mark
 this as invalid for now, since I don't have any reason to believe that
 using a <textarea> tag would be simpler.

-- 
Ticket URL: <http://trac.dojotoolkit.org/ticket/4979#comment:4>
dojo <http://dojotoolkit.org/>
The Dojo UI Toolkit


More information about the Dojo-checkins mailing list