jonleighton/poltergeist — pull request #433 by eostrom (2013-12-18 20:56:50+00:00)
Title: Fixed #432, setting multiple contenteditables.

It seems that if something else has the input focus when we call `set` on a `contenteditable`, the wrong text is deleted. By clicking on the `contenteditable` first, we ensure we'll delete the right text.

I'm not entirely satisfied with this fix, which calls `click` from the `set` method. It kind of seems like it should be `deleteText`'s job to make sure it's deleting the right element's text. But (a) just making `deleteText` call `@element.focus()` or `@element.click()` didn't work, and (b) I'm not really sure it should be `deleteText`'s job. What if not all elements require clicking before their text can be deleted?

But this fixes the problem as I currently understand it, so I'm submitting it. Comments welcome.