New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Amend test_designMode to accept either empty string or br tag #18470
Amend test_designMode to accept either empty string or br tag #18470
Conversation
@julianrkung can you please explain how you tested this with other browsers and which version of Chrome you were using? In my case I tested with a data URL and Chrome 76.0.3809.100. |
@whimboo I appreciate the quick reply! Chrome version: Version 76.0.3809.100 (Official Build) (64-bit) I did the same procedure for Firefox and got |
Thanks! So I did a mistake by manually removing the content and not doing it via As such lets get clarification first what the HTML spec (and not the WebDriver one) recommends under such a situation. |
The conclusion from https://bugzilla.mozilla.org/show_bug.cgi?id=1573801 so far is that the behaviour of contenteditable is not defined and that both behaviours is currently acceptable, e.g. the WebDriver conformance tests should accept both There is interest from Mozilla’s side to be compatible with Chrome’s behaviour, and there are two things that makes this challenging:
It’s my understanding that 1 is not a blocker. |
@andreastt I assume this would also require a WebDriver spec change before it can be pushed? |
@whimboo I don’t think so? The spec says to set the editing host’s Am I missing something? |
Ok, so the spec doesn't tell anything about With the current behavior in Firefox we would just not bail out already in step 1, but always try to clear the element, even it has been cleared before. Which also means additional |
Could this PR be merged now? Thanks. |
I see Andreas has approved, so I'm merging it. |
This pull request is a continuation of this merged and then reverted pull request.
The innerHTML property should be an empty string according to the W3C spec here: element clear.
The clear should follow the "To clear a content editable element" subroutine, which states:
In the reverted PR,I replaced the
<br>
tag with an empty string. This PR, however, accepts both. This change is necessary because, according to the spec, the element should return an empty string for its innerHTML after its contents are cleared, so the test should be able to pass if the element's innerHTML is an empty string (correct behavior with respect to the spec).In the closed PR linked above, it's said that all Firefox, Chrome, and Safari show a
<br>
tag for empty content-editable elements in developer tools. I was able to reproduce this in Firefox but was unable to reproduce it in Chrome (Chrome gave the empty string""
whereas Firefox gave the<br>
tag). I did not attempt reproducing in Safari.