Opened 4 years ago

Closed 20 months ago

Last modified 20 months ago

#10891 closed enhancement (duplicate)

Internal support for conditional scripts (same as existing conditional style support)

Reported by: jdub Owned by:
Priority: normal Milestone:
Component: General Version: 2.9
Severity: normal Keywords: has-patch
Cc:

Description

Although it's not exposed through the wp_enqueue_style API, you can add a conditional to the queued style (by twiddling $wp_styles) and WP_Styles::do_item will do the right thing. This is used within core to provide CSS to poopy browsers ("lt IE 7").

This patch adds similar internal-only support for script conditionals to WP_Scripts::do_item.

It might be nice to expose this in the wp_enqueue_* API at some point, but for now this will do. :-)

Attachments (1)

script-conditionals.diff (1011 bytes) - added by jdub 4 years ago.

Download all attachments as: .zip

Change History (6)

jdub4 years ago

  • Milestone changed from Unassigned to 2.9
  • Milestone changed from 2.9 to Future Release

We discussed this in todays dev meetup and we are not sure if this is the best way to achieve the requirement here and also about how this would interact with the script concatentation so we don't think it is right for 2.9 due to the feature freeze.

Moving out to future for now.

Also the current patch doesn't work when core scripts are concatenated. The conditional script has to be taken out of the concat queue and printed separately.

  • Resolution set to duplicate
  • Status changed from new to closed

There is a newer ticket for this, which seems to have made some more progress: #16024.

Closing this one as a duplicate.

  • Milestone Future Release deleted
Note: See TracTickets for help on using tickets.