As a developer trying to ascertain the current mw-editform formtype (preview, diff, initial, etc.), I would like a data attribute to be added to the #editform element, so that it is much easier for the front-end to figure out the current state of the edit form.
This would be helpful in solving T355043: "Show preview" or "Show changes" twice can clear Edit Recovery data, and I have a WIP patch which I believe would achieve this here;
diff --git a/includes/editpage/EditPage.php b/includes/editpage/EditPage.php index 8bdaab05840..3b74a5c3a4f 100644 --- a/includes/editpage/EditPage.php +++ b/includes/editpage/EditPage.php @@ -2998,7 +2998,8 @@ class EditPage implements IEditObject { 'name' => self::EDITFORM_ID, 'method' => 'post', 'action' => $this->getActionURL( $this->getContextTitle() ), - 'enctype' => 'multipart/form-data' + 'enctype' => 'multipart/form-data', + 'data-mw-editform-type' => $this->formtype ] ) );
afaict data-mw-editform-type follows the data-mw-{component} standard for data attributes.