Move the summary jQuery plugin to it's own file and clean it up. Currently there is too much binding/unbinding going on.
Take formUpdated out of there and to it's own file while making it better: #1636992: form.js' formUpdated event is unreliable/incomplete
Put fillUserInfoFromCookie behavior somewhere else maybe?

Replace form.js with 3 files and update the references to the proper file in the rest of the code.

Files: 
CommentFileSizeAuthor
#8 core-js-refactor-form-1685146-8-do-not-test.patch5.77 KBnod_
#5 1685146-refactor-form-js.patch7.31 KBrballou
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1685146-refactor-form-js.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

Comments

BONUS: Investigate if adding basic events and detach makes sense, as described in #1763812: [META] Provide complete attach/detach with basic events.

Issue tags:+Needs JS testing

tag

The following modules use the summary functionality provided by `form.js`:

  • block
  • book
  • comment
  • filter
  • menu
  • node
  • path
  • system

A couple questions regarding how to handle updating their library information:

  1. The block module does not explicitly require the summary functionality (it checks if it exists first and exits if not), should I update that to include it as a dependency?
  2. Most of the modules specify `drupal.form` as a dependency. Is this the same as `core/misc/form.js`?

1. don't think so, i'd have to dig into but it's a small thing.
2. yes

:)

Status:Active» Needs review
StatusFileSize
new7.31 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1685146-refactor-form-js.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

Sweet, figured out how the drupal.form bit worked :)

Anyway, here's an initial patch that: removes the summary jQuery code to it's own file, core/misc/drupal.summary.js; updates the system library info; updates the modules above so that there library info calls include the new file; and changes the bindings in the summary code to on/off calls. I have not rolled out any updates for the other two pieces of form.js code. Also I only added drupal.summary as dependencies, I did not check if they code was using the other functionality and remove drupal.form as needed.

I currently have this code push out to github at: https://github.com/robballou/drupal/tree/8.x-form-js

Status:Needs review» Needs work

The last submitted patch, 1685146-refactor-form-js.patch, failed testing.

Just posting the code I have so far, needs some more work but it's a good re-start. The changes made in #5 are not included in this patch, but they should!

this patch will fix #1636992: form.js' formUpdated event is unreliable/incomplete and #1515734: form.js' 'formUpdated' behavior is slow because it binds to each element rather than delegating also, not closing yet, some people might complain about the scope creep :þ

This patch needs to be applied on top of #1705618-26: Double click prevention on form submission.

Priority:Normal» Critical

So is #1636992: form.js' formUpdated event is unreliable/incomplete then a duplicate of this one?

In either case, this blocks #1636992, and #1636992 is critical, so marking this as critical.