Make WordPress Core

Changeset 42522


Ignore:
Timestamp:
01/17/2018 01:30:35 AM (7 years ago)
Author:
westonruter
Message:

Widgets: Prevent checkValidity from running on a form when widget is first adding to sidebar.

Amends [41352].
See #23120.
Fixes #43003 for 4.9 branch.

Location:
branches/4.9
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.9

  • branches/4.9/src/wp-admin/js/widgets.js

    r41814 r42522  
    514514        var self = this, data, a,
    515515            sidebarId = widget.closest( 'div.widgets-sortables' ).attr( 'id' ),
    516             form = widget.find( 'form' );
    517 
    518         if ( ! del && form.prop( 'checkValidity' ) && ! form[0].checkValidity() ) {
     516            form = widget.find( 'form' ),
     517            isAdd = widget.find( 'input.add_new' ).val();
     518
     519        if ( ! del && ! isAdd && form.prop( 'checkValidity' ) && ! form[0].checkValidity() ) {
    519520            return;
    520521        }
Note: See TracChangeset for help on using the changeset viewer.