| @@ -12,8 +12,22 @@ | ||
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | 14 | var wp_optimize = window.wp_optimize || {}; |
| 15 | 15 | |
| 16 | +// WordPress v4.9 uses Backbone v1.3.3, which does not support the preinitialize() hook. | |
| 17 | +// Therefore, we are adding a patch to enable support for the preinitialize() hook. | |
| 18 | +(function() { | |
| 19 | + var OriginalView = Backbone.View; | |
| 20 | + Backbone.View = function(options) { | |
| 21 | + if (typeof this.preinitialize === 'function') { | |
| 22 | + this.preinitialize.apply(this, arguments); | |
| 23 | + } | |
| 24 | + return OriginalView.apply(this, arguments); | |
| 25 | + }; | |
| 26 | + Backbone.View.prototype = OriginalView.prototype; | |
| 27 | + Backbone.View.extend = OriginalView.extend; | |
| 28 | +})(); | |
| 29 | + | |
| 16 | 30 | (function($, wp) { |
| 17 | 31 | 'use strict'; |
| 18 | 32 | var modal = {}; |
| 19 | 33 | modal.views = {}; |