WordPress.org

Make WordPress Core

Opened 10 years ago

Closed 8 years ago

Last modified 8 years ago

#10891 closed enhancement (duplicate)

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

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

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 10 years ago.

Download all attachments as: .zip

Change History (6)

#1 @scribu
10 years ago

  • Milestone changed from Unassigned to 2.9

#2 @westi
10 years ago

  • 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.

#3 @azaozz
10 years ago

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.

#4 @demetris
8 years ago

  • 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.

#5 @SergeyBiryukov
8 years ago

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