Add support for IE conditional comments for WP_Scripts to match the functionality of WP_Styles, including unit tests. Props filosofo, aaroncampbell, ethitter, georgestephanis, valendesigns. Fixes #16024.

git-svn-id: https://develop.svn.wordpress.org/trunk@31223 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz
2015-01-17 01:36:55 +00:00
parent 5378b4e000
commit f18854e866
3 changed files with 87 additions and 9 deletions

View File

@@ -271,3 +271,25 @@ function wp_script_is( $handle, $list = 'enqueued' ) {
return (bool) wp_scripts()->query( $handle, $list );
}
/**
* Add metadata to a script.
*
* Works only if the script has already been added.
*
* Possible values for $key and $value:
* 'conditional' string Comments for IE 6, lte IE 7, etc.
*
* @see WP_Dependency::add_data()
*
* @since 4.2.0
*
* @param string $handle Name of the script.
* @param string $key Name of data point for which we're storing a value.
* @param mixed $value String containing the data to be added.
* @return bool True on success, false on failure.
*/
function wp_script_add_data( $handle, $key, $value ){
global $wp_scripts;
return $wp_scripts->add_data( $handle, $key, $value );
}