Changeset 47038
- Timestamp:
- 01/04/2020 01:26:26 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/js/_enqueues/wp/customize/base.js
r46800 r47038 52 52 // Add prototype properties (instance properties) to the subclass, 53 53 // if supplied. 54 if ( protoProps ) 54 if ( protoProps ) { 55 55 $.extend( child.prototype, protoProps ); 56 } 56 57 57 58 // Add static properties to the constructor function, if supplied. 58 if ( staticProps ) 59 if ( staticProps ) { 59 60 $.extend( child, staticProps ); 61 } 60 62 61 63 // Correctly set child's `prototype.constructor`. … … 133 135 134 136 while ( typeof proto.constructor !== 'undefined' ) { 135 if ( proto.constructor === constructor ) 137 if ( proto.constructor === constructor ) { 136 138 return true; 137 if ( typeof proto.constructor.__super__ === 'undefined' ) 139 } 140 if ( typeof proto.constructor.__super__ === 'undefined' ) { 138 141 return false; 142 } 139 143 proto = proto.constructor.__super__; 140 144 } … … 149 153 api.Events = { 150 154 trigger: function( id ) { 151 if ( this.topics && this.topics[ id ] ) 155 if ( this.topics && this.topics[ id ] ) { 152 156 this.topics[ id ].fireWith( this, slice.call( arguments, 1 ) ); 157 } 153 158 return this; 154 159 }, … … 162 167 163 168 unbind: function( id ) { 164 if ( this.topics && this.topics[ id ] ) 169 if ( this.topics && this.topics[ id ] ) { 165 170 this.topics[ id ].remove.apply( this.topics[ id ], slice.call( arguments, 1 ) ); 171 } 166 172 return this; 167 173 } … … 352 358 */ 353 359 instance: function( id ) { 354 if ( arguments.length === 1 ) 360 if ( arguments.length === 1 ) { 355 361 return this.value( id ); 362 } 356 363 357 364 return this.when.apply( this, arguments ); … … 491 498 492 499 // If the last argument is a callback, bind it to .done() 493 if ( $.isFunction( ids[ ids.length - 1 ] ) ) 500 if ( $.isFunction( ids[ ids.length - 1 ] ) ) { 494 501 dfd.done( ids.pop() ); 502 } 495 503 496 504 /* … … 499 507 */ 500 508 $.when.apply( $, $.map( ids, function( id ) { 501 if ( self.has( id ) ) 509 if ( self.has( id ) ) { 502 510 return; 511 } 503 512 504 513 /* … … 547 556 */ 548 557 api.ensure = function( element ) { 549 return typeof element == 'string' ? $( element ) : element;558 return typeof element === 'string' ? $( element ) : element; 550 559 }; 551 560 … … 745 754 746 755 // Check to make sure the origin is valid. 747 if ( this.origin() && event.origin !== this.origin() ) 756 if ( this.origin() && event.origin !== this.origin() ) { 748 757 return; 749 750 // Ensure we have a string that's JSON.parse-able 758 } 759 760 // Ensure we have a string that's JSON.parse-able. 751 761 if ( typeof event.data !== 'string' || event.data[0] !== '{' ) { 752 762 return; … … 756 766 757 767 // Check required message properties. 758 if ( ! message || ! message.id || typeof message.data === 'undefined' ) 768 if ( ! message || ! message.id || typeof message.data === 'undefined' ) { 759 769 return; 770 } 760 771 761 772 // Check if channel names match. 762 if ( ( message.channel || this.channel() ) && this.channel() !== message.channel ) 773 if ( ( message.channel || this.channel() ) && this.channel() !== message.channel ) { 763 774 return; 775 } 764 776 765 777 this.trigger( message.id, message.data ); … … 777 789 data = typeof data === 'undefined' ? null : data; 778 790 779 if ( ! this.url() || ! this.targetWindow() ) 791 if ( ! this.url() || ! this.targetWindow() ) { 780 792 return; 793 } 781 794 782 795 message = { id: id, data: data }; 783 if ( this.channel() ) 796 if ( this.channel() ) { 784 797 message.channel = this.channel(); 798 } 785 799 786 800 this.targetWindow().postMessage( JSON.stringify( message ), this.origin() );
Note: See TracChangeset
for help on using the changeset viewer.