[wp-trac] [WordPress Trac] #37258: Missing parameter in getNodes method of wp.mce.views

WordPress Trac noreply at wordpress.org
Sun Jul 3 08:00:35 UTC 2016


#37258: Missing parameter in getNodes method of wp.mce.views
--------------------------+-----------------------------
 Reporter:  programmin    |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Editor        |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 In current WP, and in last few versions, calling a view's getNodes with
 callback, expects a callback that will take:

 editor, this, $( this ).find( '.wpview-content' ).get( 0 )

 as arguments.

 https://core.trac.wordpress.org/browser/tags/4.5.3/src/wp-includes/js/mce-
 view.js#L379

 In current WP 4.6 beta, this same getNodes function expects a callback to
 accept only editor, and this as arguments:

 {{{#!php

                 getNodes: function( callback, rendered ) {
                         this.getEditors( function( editor ) {
                                 var self = this;

                                 $( editor.getBody() )
                                         .find( '[data-wpview-text="' +
 self.encodedText + '"]' )
                                         .filter( function() {
                                                 var data;

                                                 if ( rendered == null ) {
                                                         return true;
                                                 }

                                                 data = $( this ).data(
 'rendered' ) === true;

                                                 return rendered ? data : !
 data;
                                         } )
                                         .each( function() {
                                                 callback.call( self,
 editor, this );
                                         } );
                         } );
                 },
 }}}


 Was there a reason for this breaking change, a reworking of wp-views
 system? Or just removing the redundant parameter?

--
Ticket URL: <https://core.trac.wordpress.org/ticket/37258>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list