Inline `<script>`s that are only printed in the admin for pages that are served with the HTML5 doctype absolutely do not need `CDATA` comments.

Props tw2113 for the initial patch.
See #18788.

Built from https://develop.svn.wordpress.org/trunk@31034


git-svn-id: http://core.svn.wordpress.org/trunk@31015 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2015-01-03 05:46:25 +00:00
parent b39c37ff89
commit af0e5cc851
13 changed files with 1 additions and 46 deletions

View File

@ -390,7 +390,6 @@ class Custom_Image_Header {
?>
<script type="text/javascript">
/* <![CDATA[ */
(function($){
var default_color = '<?php echo $default_color; ?>',
header_text_fields;
@ -433,7 +432,6 @@ class Custom_Image_Header {
<?php endif; ?>
});
})(jQuery);
/* ]]> */
</script>
<?php
}
@ -445,7 +443,6 @@ class Custom_Image_Header {
*/
public function js_2() { ?>
<script type="text/javascript">
/* <![CDATA[ */
function onEndCrop( coords ) {
jQuery( '#x1' ).val(coords.x);
jQuery( '#y1' ).val(coords.y);
@ -507,7 +504,6 @@ class Custom_Image_Header {
}
});
});
/* ]]> */
</script>
<?php
}

View File

@ -24,7 +24,6 @@ $title = __('Export');
function export_add_js() {
?>
<script type="text/javascript">
//<![CDATA[
jQuery(document).ready(function($){
var form = $('#export-filters'),
filters = form.find('.export-filters');
@ -37,7 +36,6 @@ function export_add_js() {
}
});
});
//]]>
</script>
<?php
}

View File

@ -239,10 +239,8 @@ function _cleanup_image_add_caption( $matches ) {
function media_send_to_editor($html) {
?>
<script type="text/javascript">
/* <![CDATA[ */
var win = window.dialogArguments || opener || parent || top;
win.send_to_editor('<?php echo addslashes($html); ?>');
/* ]]> */
</script>
<?php
exit;
@ -448,11 +446,9 @@ if ( ( is_array( $content_func ) && ! empty( $content_func[1] ) && 0 === strpos(
wp_enqueue_style( 'ie' );
?>
<script type="text/javascript">
//<![CDATA[
addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
var ajaxurl = '<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>', pagenow = 'media-upload-popup', adminpage = 'media-upload-popup',
isRtl = <?php echo (int) is_rtl(); ?>;
//]]>
</script>
<?php
/** This action is documented in wp-admin/admin-header.php */
@ -682,10 +678,8 @@ function media_upload_form_handler() {
if ( isset($_POST['insert-gallery']) || isset($_POST['update-gallery']) ) { ?>
<script type="text/javascript">
/* <![CDATA[ */
var win = window.dialogArguments || opener || parent || top;
win.tb_remove();
/* ]]> */
</script>
<?php
exit;
@ -1946,7 +1940,6 @@ function media_upload_type_form($type = 'file', $errors = null, $id = null) {
<?php media_upload_form( $errors ); ?>
<script type="text/javascript">
//<![CDATA[
jQuery(function($){
var preloaded = $(".media-item.preloaded");
if ( preloaded.length > 0 ) {
@ -1954,7 +1947,6 @@ jQuery(function($){
}
updateMediaForm();
});
//]]>
</script>
<div id="media-items"><?php
@ -2009,7 +2001,6 @@ function media_upload_type_url_form($type = null, $errors = null, $id = null) {
<h3 class="media-title"><?php _e('Insert media from another website'); ?></h3>
<script type="text/javascript">
//<![CDATA[
var addExtImage = {
width : '',
@ -2099,8 +2090,6 @@ jQuery(document).ready( function($) {
$('table.describe').toggleClass('not-image', $('#not-image').prop('checked') );
});
});
//]]>
</script>
<div id="media-items">

View File

@ -955,9 +955,7 @@ function can_edit_network( $site_id ) {
function _thickbox_path_admin_subfolder() {
?>
<script type="text/javascript">
//<![CDATA[
var tb_pathToImage = "<?php echo includes_url( 'js/thickbox/loadingAnimation.gif', 'relative' ); ?>";
//]]>
</script>
<?php
}

View File

@ -1549,7 +1549,6 @@ function iframe_header( $title = '', $limit_styles = false ) {
wp_enqueue_style( 'colors' );
?>
<script type="text/javascript">
//<![CDATA[
addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
function tb_close(){var win=window.dialogArguments||opener||parent||top;win.tb_remove();}
var ajaxurl = '<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>',
@ -1559,7 +1558,6 @@ var ajaxurl = '<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>',
thousandsSeparator = '<?php echo addslashes( $wp_locale->number_format['thousands_sep'] ); ?>',
decimalPoint = '<?php echo addslashes( $wp_locale->number_format['decimal_point'] ); ?>',
isRtl = <?php echo (int) is_rtl(); ?>;
//]]>
</script>
<?php
/** This action is documented in wp-admin/admin-header.php */
@ -1596,13 +1594,11 @@ $admin_body_classes = apply_filters( 'admin_body_class', '' );
?>
<body<?php if ( isset($GLOBALS['body_id']) ) echo ' id="' . $GLOBALS['body_id'] . '"'; ?> class="wp-admin wp-core-ui no-js iframe <?php echo $admin_body_classes . ' ' . $admin_body_class; ?>">
<script type="text/javascript">
//<![CDATA[
(function(){
var c = document.body.className;
c = c.replace(/no-js/, 'js');
document.body.className = c;
})();
//]]>
</script>
<?php
}
@ -1729,7 +1725,6 @@ function _media_states( $post ) {
function compression_test() {
?>
<script type="text/javascript">
/* <![CDATA[ */
var testCompression = {
get : function(test) {
var x;
@ -1776,7 +1771,6 @@ function compression_test() {
}
};
testCompression.check();
/* ]]> */
</script>
<?php
}
@ -1975,7 +1969,6 @@ final class WP_Internal_Pointers {
?>
<script type="text/javascript">
//<![CDATA[
(function($){
var options = <?php echo wp_json_encode( $args ); ?>, setup;
@ -2001,7 +1994,6 @@ final class WP_Internal_Pointers {
$(document).ready( setup );
})( jQuery );
//]]>
</script>
<?php
}

View File

@ -177,9 +177,7 @@ if ( ! wp_is_large_network( 'users' ) && apply_filters( 'show_network_site_users
require( ABSPATH . 'wp-admin/admin-header.php' ); ?>
<script type="text/javascript">
/* <![CDATA[ */
var current_site_id = <?php echo $id; ?>;
/* ]]> */
</script>

View File

@ -28,7 +28,6 @@ $timezone_format = _x('Y-m-d G:i:s', 'timezone date format');
function options_general_add_js() {
?>
<script type="text/javascript">
//<![CDATA[
jQuery(document).ready(function($){
var $siteName = $( '#wp-admin-bar-site-name' ).children( 'a' ).first(),
homeURL = ( <?php echo wp_json_encode( get_home_url() ); ?> || '' ).replace( /^(https?:\/\/)?(www\.)?/, '' );
@ -77,7 +76,6 @@ function options_general_add_js() {
}
});
});
//]]>
</script>
<?php
}

View File

@ -54,7 +54,6 @@ get_current_screen()->set_help_sidebar(
function options_permalink_add_js() {
?>
<script type="text/javascript">
//<![CDATA[
jQuery(document).ready(function() {
jQuery('.permalink-structure input:radio').change(function() {
if ( 'custom' == this.value )
@ -65,7 +64,6 @@ jQuery(document).ready(function() {
jQuery("#custom_selection").attr('checked', 'checked');
});
});
//]]>
</script>
<?php
}

View File

@ -23,7 +23,6 @@ $parent_file = 'options-general.php';
function options_reading_add_js() {
?>
<script type="text/javascript">
//<![CDATA[
jQuery(document).ready(function($){
var section = $('#front-static-pages'),
staticPage = section.find('input:radio[value="page"]'),
@ -34,7 +33,6 @@ function options_reading_add_js() {
check_disabled();
section.find('input:radio').change(check_disabled);
});
//]]>
</script>
<?php
}

View File

@ -109,7 +109,6 @@ if ( !empty($_REQUEST['ajax']) ) {
switch ($_REQUEST['ajax']) {
case 'video': ?>
<script type="text/javascript">
/* <![CDATA[ */
jQuery('.select').click(function() {
append_editor(jQuery('#embed-code').val());
jQuery('#extra-fields').hide();
@ -119,7 +118,6 @@ if ( !empty($_REQUEST['ajax']) ) {
jQuery('#extra-fields').hide();
jQuery('#extra-fields').html('');
});
/* ]]> */
</script>
<div class="postbox">
<h2><label for="embed-code"><?php _e('Embed Code') ?></label></h2>
@ -132,14 +130,12 @@ if ( !empty($_REQUEST['ajax']) ) {
case 'photo_thickbox': ?>
<script type="text/javascript">
/* <![CDATA[ */
jQuery('.cancel').click(function() {
tb_remove();
});
jQuery('.select').click(function() {
image_selector(this);
});
/* ]]> */
</script>
<h3 class="tb"><label for="tb_this_photo_description"><?php _e('Description') ?></label></h3>
<div class="titlediv">
@ -299,11 +295,9 @@ die;
?>
<title><?php _e('Press This') ?></title>
<script type="text/javascript">
//<![CDATA[
addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
var ajaxurl = '<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>', pagenow = 'press-this', isRtl = <?php echo (int) is_rtl(); ?>;
var photostorage = false;
//]]>
</script>
<?php

View File

@ -229,12 +229,10 @@ endif; // $error
<br class="clear" />
</div>
<script type="text/javascript">
/* <![CDATA[ */
jQuery(document).ready(function($){
$('#template').submit(function(){ $('#scrollto').val( $('#newcontent').scrollTop() ); });
$('#newcontent').scrollTop( $('#scrollto').val() );
});
/* ]]> */
</script>
<?php
break;

View File

@ -77,11 +77,9 @@ class WP_Embed {
?>
<script type="text/javascript">
/* <![CDATA[ */
jQuery(document).ready(function($){
$.get("<?php echo admin_url( 'admin-ajax.php?action=oembed-cache&post=' . $post->ID, 'relative' ); ?>");
});
/* ]]> */
</script>
<?php
}

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.2-alpha-31033';
$wp_version = '4.2-alpha-31034';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.