Add support for contenteditable elements. #533

wants to merge 1 commit into


None yet
4 participants

david commented Oct 27, 2011

This is based on jnicklas#182, but I also added support for rack-test. Please let me know if any changes are needed.


jnicklas commented Oct 28, 2011

There have been discussions surrounding this, somewhere on another issue or on the mailing list before. We came to the conclusion that it's not a good idea to add this.

@jnicklas jnicklas closed this Oct 28, 2011

Can you provide a link to this discussion?

The pages with these closed pull requests and issues are at the topic of the front page in the google search for

"capybara contenteditable"


JonRowe commented Jul 17, 2012

+1 for a link to the discussion, cant find it by google myself, it seems like we should be able to edit the content of these elements...


jnicklas commented Jul 17, 2012

I can't remember where the discussion took place, and google and github didn't help me either. But regarding this pull request, the question is: what would you do with this functionality. As far as I can see contenteditable really has no purpose in a driver which doesn't support JavaScript. contenteditable elements aren't treated as form elements, and thus aren't submitted along with form data.

I tried really hard to come up with a case where changing an element due to it having contenteditable would cause any kind of effect at all in the absence of JavaScript, and the only thing I could come up with is something like this:

<button type="submit" contenteditable="true" name="button">Change me</button>

A contenteditable button. Curisouly, I tried this in Chrome and yes, it does work, but it's a pretty ludicrous edge case isn't it?

Why then support something which doesn't make any sense. Note that Selenium already supports it, it just isn't tested.


JonRowe commented Jul 17, 2012

I agree it makes no sense in drivers that don't support JS (other than uniformity maybe) but it does make sense for the JS drivers. Looking at the head it doesn't look like the selenium driver would support it as set doesn't do anything for element's it doesn't know how to manipulate, and content-editable is never mentioned, so you'd have to drop down to native and send_keys yourself... which makes me sad...

I'd be open to writing some tests for and making it work on selenium if the behaviour is agreeable but as the previous two PR's with this functionality have been rejected and I'm using a different driver anyway (poltergeist)...


jnicklas commented Jul 17, 2012

@JonRowe I'm working on a major refactor of the test suite, which will affect how these tests would be written. I should be able to finish that up in the next couple of days. I'd suggest holding off until then, if you're interested in making this work in Selenium.

@jonleighton jonleighton referenced this pull request in teampoltergeist/poltergeist Sep 1, 2012


Allow set or editing of content-editable #113


JonRowe commented Dec 15, 2012

See pull request #911

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment