diff --git a/core/includes/common.inc b/core/includes/common.inc
index 77ea718..5cb35ae 100644
--- a/core/includes/common.inc
+++ b/core/includes/common.inc
@@ -3467,6 +3467,27 @@ function drupal_pre_render_html_tag($element) {
 }
 
 /**
+ * Pre-render callback: Wraps array in an Attribute for rendering in templates.
+ *
+ * @param array $elements
+ *
+ * @return
+ *   The passed-in elements as an Attribute.
+ */
+function drupal_pre_render_attributes($elements) {
+  foreach ($elements as $key => $value) {
+    if ($key[0] != '#') {
+      $attributes[$key] = $value;
+      unset($elements[$key]);
+    }
+  }
+  if (isset($attributes)) {
+    $elements['#children'] = new Attribute($attributes);
+  }
+  return new Attribute($elements);
+}
+
+/**
  * Pre-render callback: Renders a link into #markup.
  *
  * Doing so during pre_render gives modules a chance to alter the link parts.
diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/RenderElementTypesTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/RenderElementTypesTest.php
index 9ba4bf4..9ddfe9b 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Common/RenderElementTypesTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Common/RenderElementTypesTest.php
@@ -113,4 +113,26 @@ function testHtmlTag() {
     $this->assertElements($elements);
   }
 
+  /**
+   * Tests system #type 'attributes'.
+   */
+  function testAttributes() {
+    $elements = array(
+      // Test auto-closure meta tag generation.
+      array(
+        'name' => "#type 'attributes'",
+        'value' => array(
+          '#type' => 'attributes',
+          'name' => 'description',
+          'content' => 'Drupal test',
+          'class' => array('odd', 'first', 'last'),
+          'checked' => TRUE,
+        ),
+        'expected' => ' name="description" content="Drupal test" class="odd first last" checked',
+      ),
+    );
+
+    $this->assertElements($elements);
+  }
+
 }
diff --git a/core/modules/system/system.module b/core/modules/system/system.module
index 03f9042..1838dbc 100644
--- a/core/modules/system/system.module
+++ b/core/modules/system/system.module
@@ -279,6 +279,9 @@ function system_element_info() {
     '#attributes' => array(),
     '#value' => NULL,
   );
+  $types['attributes'] = array(
+    '#pre_render' => array('drupal_pre_render_attributes'),
+  );
   $types['styles'] = array(
     '#items' => array(),
     '#pre_render' => array('drupal_pre_render_styles'),
