nytimes / ice

track changes with javascript
Other
1.71k stars 194 forks source link

Fixed copy & paste behavior in Webkit (Safari and Chrome) #53

Closed unknower closed 11 years ago

unknower commented 11 years ago

This commit fixes two problems:

  1. createDiv() was not functioning properly in some cases (in Webkit). When createDiv() tried to ice.dom.empty() and reuse the hidden div, the empty() seemed to mess up the attached event handlers. So instead in this commit, I entirely remove the hidden div and re-create it before using it every time.
  2. On Webkit it used to NOT paste content in on first attempt because of the difference in when handlePaste() is called compared to Firefox. Changed it so that handlePaste() gets called after its parent event handlers in case of Webkit. On firefox it immediately calls handlePaste().