Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#36695 closed enhancement (fixed)

wp-util: update to latest _.template syntax

Reported by: jnylen0's profile jnylen0 Owned by: rachelbaker's profile rachelbaker
Milestone: 4.6 Priority: normal
Severity: normal Version: 4.6
Component: General Keywords: has-patch
Focuses: javascript Cc:


With the upgrade to Underscore 1.8.3 in [36546] and 4.5, the preferred syntax for passing options to _.template is to pass two parameters (template, options) rather than three (template, data, options). This patch updates the wp.template function accordingly (and also cleans up the style of the immediately surrounding code).

No functional changes, since Underscore supports passing data = null for backwards compatibility, but we should fix this to be consistent with the correct usage of the function.

Attachments (2)

36695.diff (926 bytes) - added by jnylen0 8 years ago.
36695.2.diff (889 bytes) - added by jnylen0 8 years ago.
Fix misreading of WP coding standards.

Download all attachments as: .zip

Change History (6)

8 years ago

#1 @jnylen0
8 years ago

  • Keywords has-patch added

This ticket was mentioned in Slack in #core by jnylen. View the logs.

8 years ago

#3 @rachelbaker
8 years ago

  • Milestone changed from Awaiting Review to 4.6
  • Owner set to rachelbaker
  • Status changed from new to reviewing

8 years ago

Fix misreading of WP coding standards.

#4 @rachelbaker
8 years ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 37851:

Utils: Update wp.template to match parameter changes to _.template in Underscore 1.8.3.

Removes passing a null value for the back-compat only data parameter to _.template.

Props jnylen0.
Fixes #36695.

Note: See TracTickets for help on using tickets.