diff options
Diffstat (limited to 'src/wp-includes/widgets')
-rw-r--r-- | src/wp-includes/widgets/class-wp-widget-archives.php | 8 | ||||
-rw-r--r-- | src/wp-includes/widgets/class-wp-widget-categories.php | 7 |
2 files changed, 6 insertions, 9 deletions
diff --git a/src/wp-includes/widgets/class-wp-widget-archives.php b/src/wp-includes/widgets/class-wp-widget-archives.php index f32aa9bbb0..21d3a7b672 100644 --- a/src/wp-includes/widgets/class-wp-widget-archives.php +++ b/src/wp-includes/widgets/class-wp-widget-archives.php @@ -100,8 +100,6 @@ class WP_Widget_Archives extends WP_Widget { $label = __( 'Select Post' ); break; } - - $type_attr = current_theme_supports( 'html5', 'script' ) ? '' : ' type="text/javascript"'; ?> <option value=""><?php echo esc_html( $label ); ?></option> @@ -109,8 +107,8 @@ class WP_Widget_Archives extends WP_Widget { </select> -<script<?php echo $type_attr; ?>> -/* <![CDATA[ */ + <?php ob_start(); ?> +<script> (function() { var dropdown = document.getElementById( "<?php echo esc_js( $dropdown_id ); ?>" ); function onSelectChange() { @@ -120,9 +118,9 @@ class WP_Widget_Archives extends WP_Widget { } dropdown.onchange = onSelectChange; })(); -/* ]]> */ </script> <?php + wp_print_inline_script_tag( str_replace( array( '<script>', '</script>' ), '', ob_get_clean() ) ); } else { $format = current_theme_supports( 'html5', 'navigation-widgets' ) ? 'html5' : 'xhtml'; diff --git a/src/wp-includes/widgets/class-wp-widget-categories.php b/src/wp-includes/widgets/class-wp-widget-categories.php index 3c009709ba..e00ce7f960 100644 --- a/src/wp-includes/widgets/class-wp-widget-categories.php +++ b/src/wp-includes/widgets/class-wp-widget-categories.php @@ -92,11 +92,10 @@ class WP_Widget_Categories extends WP_Widget { echo '</form>'; - $type_attr = current_theme_supports( 'html5', 'script' ) ? '' : ' type="text/javascript"'; + ob_start(); ?> -<script<?php echo $type_attr; ?>> -/* <![CDATA[ */ +<script> (function() { var dropdown = document.getElementById( "<?php echo esc_js( $dropdown_id ); ?>" ); function onCatChange() { @@ -106,10 +105,10 @@ class WP_Widget_Categories extends WP_Widget { } dropdown.onchange = onCatChange; })(); -/* ]]> */ </script> <?php + wp_print_inline_script_tag( str_replace( array( '<script>', '</script>' ), '', ob_get_clean() ) ); } else { $format = current_theme_supports( 'html5', 'navigation-widgets' ) ? 'html5' : 'xhtml'; |