diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php
index 10023c1..db2bdc0 100644
--- a/wp-admin/includes/template.php
+++ b/wp-admin/includes/template.php
@@ -1900,19 +1900,20 @@ function get_submit_button( $text = '', $type = 'primary large', $name = 'submit
 
 	$attributes = '';
 	if ( is_array( $other_attributes ) ) {
-		foreach ( $other_attributes as $attribute => $value ) {
-			$attributes .= $attribute . '="' . esc_attr( $value ) . '" '; // Trailing space is important
-		}
+		$attributes = get_html_attrs( $other_attributes );
 	} elseif ( ! empty( $other_attributes ) ) { // Attributes provided as a string
-		$attributes = $other_attributes;
+		$attributes = ' ' . $other_attributes;
 	}
 
-	// Don't output empty name and id attributes.
-	$name_attr = $name ? ' name="' . esc_attr( $name ) . '"' : '';
-	$id_attr = $id ? ' id="' . esc_attr( $id ) . '"' : '';
+	$attrs = array(
+		'type'    => 'submit',
+		'name'    => $name,
+		'id'      => $id,
+		'class'   => $class,
+		'value'   => $text,
+	);
 
-	$button = '<input type="submit"' . $name_attr . $id_attr . ' class="' . esc_attr( $class );
-	$button	.= '" value="' . esc_attr( $text ) . '" ' . $attributes . ' />';
+	$button = '<input' . get_html_attrs( $attrs ) . $attributes . ' />';
 
 	if ( $wrap ) {
 		$button = '<p class="submit">' . $button . '</p>';
diff --git a/wp-includes/comment-template.php b/wp-includes/comment-template.php
index 0e1e361..57d665b 100644
--- a/wp-includes/comment-template.php
+++ b/wp-includes/comment-template.php
@@ -1282,6 +1282,8 @@ function comments_popup_link( $zero = false, $one = false, $more = false, $css_c
 	$id = get_the_ID();
 	$title = get_the_title();
 	$number = get_comments_number( $id );
+	
+	$class_attr = get_html_attrs( array( 'class' => $css_class ) );
 
 	if ( false === $zero ) {
 		/* translators: %s: post title */
@@ -1305,7 +1307,7 @@ function comments_popup_link( $zero = false, $one = false, $more = false, $css_c
 	}
 
 	if ( 0 == $number && !comments_open() && !pings_open() ) {
-		echo '<span' . ((!empty($css_class)) ? ' class="' . esc_attr( $css_class ) . '"' : '') . '>' . $none . '</span>';
+		echo '<span' . $class_attr . '>' . $none . '</span>';
 		return;
 	}
 
@@ -1330,8 +1332,8 @@ function comments_popup_link( $zero = false, $one = false, $more = false, $css_c
 		echo '"';
 	}
 
-	if ( !empty( $css_class ) ) {
-		echo ' class="'.$css_class.'" ';
+	if ( $class_attr ) {
+		echo $class_attr . ' ';	
 	}
 
 	$attributes = '';
diff --git a/wp-includes/functions.php b/wp-includes/functions.php
index 9a0ee88..47824d5 100644
--- a/wp-includes/functions.php
+++ b/wp-includes/functions.php
@@ -4845,3 +4845,33 @@ function wp_delete_file( $file ) {
 		@unlink( $delete );
 	}
 }
+
+/**
+ * Get HTML attributes.
+ *
+ * @since 4.3.0
+ *
+ * @param array $attrs 
+ * @return string 
+ */
+function html_attributes( $attrs ) {
+	if ( ! is_array( $attrs ) ) {
+		return false;
+	}
+	
+	$html = array();
+	
+	foreach ( (array) $attrs as $attr => $value ) {
+		if ( is_numeric( $attr ) ) {
+			$attr = $value;
+		}
+		
+		if ( ! empty( $value ) ) {
+			$value = 'href' == $attr ? esc_url( $value ) : esc_attr( $value );
+			
+			$html[] = $attr . '="' . $value . '"';
+		}
+	}
+
+	return count( $html ) > 0 ? ' ' . implode( ' ', $html ) : '';
+}
diff --git a/wp-includes/media.php b/wp-includes/media.php
index b69b328..1b82861 100644
--- a/wp-includes/media.php
+++ b/wp-includes/media.php
@@ -758,12 +758,8 @@ function wp_get_attachment_image($attachment_id, $size = 'thumbnail', $icon = fa
 		 * @param string|array $size       Requested size.
 		 */
 		$attr = apply_filters( 'wp_get_attachment_image_attributes', $attr, $attachment, $size );
-		$attr = array_map( 'esc_attr', $attr );
-		$html = rtrim("<img $hwstring");
-		foreach ( $attr as $name => $value ) {
-			$html .= " $name=" . '"' . $value . '"';
-		}
-		$html .= ' />';
+
+		$html = '<img ' . rtrim( $hwstring ) . html_attributes( $attr ) . ' />';
 	}
 
 	return $html;
@@ -879,13 +875,14 @@ function img_caption_shortcode( $attr, $content = null ) {
 	if ( $atts['width'] < 1 || empty( $atts['caption'] ) )
 		return $content;
 
-	if ( ! empty( $atts['id'] ) )
-		$atts['id'] = 'id="' . esc_attr( $atts['id'] ) . '" ';
-
-	$class = trim( 'wp-caption ' . $atts['align'] . ' ' . $atts['class'] );
-
+	$attrs = array(
+		'id'      => $atts['id'],
+		'style'   => 'width: ' . (int) $atts['width'] . 'px;',
+		'class'   => trim( 'wp-caption ' . $atts['align'] . ' ' . $atts['class'] )
+	);
+	
 	if ( current_theme_supports( 'html5', 'caption' ) ) {
-		return '<figure ' . $atts['id'] . 'style="width: ' . (int) $atts['width'] . 'px;" class="' . esc_attr( $class ) . '">'
+		return '<figure' . get_html_attrs( $attrs ) . '>' 
 		. do_shortcode( $content ) . '<figcaption class="wp-caption-text">' . $atts['caption'] . '</figcaption></figure>';
 	}
 
@@ -909,10 +906,11 @@ function img_caption_shortcode( $attr, $content = null ) {
 	$caption_width = apply_filters( 'img_caption_shortcode_width', $caption_width, $atts, $content );
 
 	$style = '';
-	if ( $caption_width )
-		$style = 'style="width: ' . (int) $caption_width . 'px" ';
-
-	return '<div ' . $atts['id'] . $style . 'class="' . esc_attr( $class ) . '">'
+	
+	if ( $caption_width ) {
+		$attrs['style'] = 'width: ' . (int) $caption_width . 'px;';
+	}
+	return '<div' . get_html_attrs( $attrs ) . '>'
 	. do_shortcode( $content ) . '<p class="wp-caption-text">' . $atts['caption'] . '</p></div>';
 }
 
@@ -1641,17 +1639,12 @@ function wp_audio_shortcode( $attr, $content = '' ) {
 		}
 	}
 
-	$attr_strings = array();
-	foreach ( $html_atts as $k => $v ) {
-		$attr_strings[] = $k . '="' . esc_attr( $v ) . '"';
-	}
-
 	$html = '';
 	if ( 'mediaelement' === $library && 1 === $instance ) {
 		$html .= "<!--[if lt IE 9]><script>document.createElement('audio');</script><![endif]-->\n";
 	}
-	$html .= sprintf( '<audio %s controls="controls">', join( ' ', $attr_strings ) );
-
+	$html .= '<audio %s controls="controls"' . html_attributes( $html_atts ) . '>';
+	
 	$fileurl = '';
 	$source = '<source type="%s" src="%s" />';
 	foreach ( $default_types as $fallback ) {
diff --git a/wp-includes/nav-menu-template.php b/wp-includes/nav-menu-template.php
index 5feac80..a13d325 100644
--- a/wp-includes/nav-menu-template.php
+++ b/wp-includes/nav-menu-template.php
@@ -140,16 +140,8 @@ class Walker_Nav_Menu extends Walker {
 		 */
 		$atts = apply_filters( 'nav_menu_link_attributes', $atts, $item, $args, $depth );
 
-		$attributes = '';
-		foreach ( $atts as $attr => $value ) {
-			if ( ! empty( $value ) ) {
-				$value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value );
-				$attributes .= ' ' . $attr . '="' . $value . '"';
-			}
-		}
-
 		$item_output = $args->before;
-		$item_output .= '<a'. $attributes .'>';
+		$item_output .= '<a' . html_attributes( $atts ) . '>';
 		/** This filter is documented in wp-includes/post-template.php */
 		$item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;
 		$item_output .= '</a>';
diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php
old mode 100644
new mode 100755
diff --git a/wp-includes/comment-template.php b/wp-includes/comment-template.php
old mode 100644
new mode 100755
diff --git a/wp-includes/functions.php b/wp-includes/functions.php
old mode 100644
new mode 100755
diff --git a/wp-includes/media.php b/wp-includes/media.php
old mode 100644
new mode 100755
diff --git a/wp-includes/nav-menu-template.php b/wp-includes/nav-menu-template.php
old mode 100644
new mode 100755
