diff --git a/core/includes/common.inc b/core/includes/common.inc
index 5749ffe..c3d5c9d 100644
--- a/core/includes/common.inc
+++ b/core/includes/common.inc
@@ -1,6 +1,5 @@
 <?php
 
-use Drupal\Component\Utility\Crypt;
 use Drupal\Component\Utility\Json;
 use Drupal\Component\Utility\Number;
 use Drupal\Component\Utility\Settings;
@@ -21,6 +20,7 @@
 use Drupal\Core\Routing\GeneratorNotInitializedException;
 use Drupal\Core\SystemListingInfo;
 use Drupal\Core\Template\Attribute;
+use Drupal\Core\Render\Element;
 
 /**
  * @file
@@ -3854,7 +3854,7 @@ function drupal_render(&$elements) {
   }
 
   // Get the children of the element, sorted by weight.
-  $children = element_children($elements, TRUE);
+  $children = Element::children($elements, TRUE);
 
   // Initialize this element's #children, unless a #pre_render callback already
   // preset #children.
@@ -4471,21 +4471,21 @@ function drupal_sort_title($a, $b) {
  * Checks if the key is a property.
  */
 function element_property($key) {
-  return $key[0] == '#';
+  return Element::property($key);
 }
 
 /**
  * Gets properties of a structured array element (keys beginning with '#').
  */
 function element_properties($element) {
-  return array_filter(array_keys((array) $element), 'element_property');
+  return Element::properties($element);
 }
 
 /**
  * Checks if the key is a child.
  */
 function element_child($key) {
-  return !isset($key[0]) || $key[0] != '#';
+  return Element::child($key);
 }
 
 /**
@@ -4503,41 +4503,7 @@ function element_child($key) {
  *   The array keys of the element's children.
  */
 function element_children(&$elements, $sort = FALSE) {
-  // Do not attempt to sort elements which have already been sorted.
-  $sort = isset($elements['#sorted']) ? !$elements['#sorted'] : $sort;
-
-  // Filter out properties from the element, leaving only children.
-  $children = array();
-  $sortable = FALSE;
-  foreach ($elements as $key => $value) {
-    if ($key === '' || $key[0] !== '#') {
-      if (is_array($value)) {
-        $children[$key] = $value;
-        if (isset($value['#weight'])) {
-          $sortable = TRUE;
-        }
-      }
-      // Only trigger an error if the value is not null.
-      // @see http://drupal.org/node/1283892
-      elseif (isset($value)) {
-        trigger_error(t('"@key" is an invalid render array key', array('@key' => $key)), E_USER_ERROR);
-      }
-    }
-  }
-  // Sort the children if necessary.
-  if ($sort && $sortable) {
-    uasort($children, 'element_sort');
-    // Put the sorted children back into $elements in the correct order, to
-    // preserve sorting if the same element is passed through
-    // element_children() twice.
-    foreach ($children as $key => $child) {
-      unset($elements[$key]);
-      $elements[$key] = $child;
-    }
-    $elements['#sorted'] = TRUE;
-  }
-
-  return array_keys($children);
+  return Element::children($elements, $sort);
 }
 
 /**
@@ -4550,25 +4516,7 @@ function element_children(&$elements, $sort = FALSE) {
  *   The array keys of the element's visible children.
  */
 function element_get_visible_children(array $elements) {
-  $visible_children = array();
-
-  foreach (element_children($elements) as $key) {
-    $child = $elements[$key];
-
-    // Skip un-accessible children.
-    if (isset($child['#access']) && !$child['#access']) {
-      continue;
-    }
-
-    // Skip value and hidden elements, since they are not rendered.
-    if (isset($child['#type']) && in_array($child['#type'], array('value', 'hidden'))) {
-      continue;
-    }
-
-    $visible_children[$key] = $child;
-  }
-
-  return array_keys($visible_children);
+  return Element::getVisibleChildren($elements);
 }
 
 /**
@@ -4584,16 +4532,7 @@ function element_get_visible_children(array $elements) {
  *   no property name needs to be specified.
  */
 function element_set_attributes(array &$element, array $map) {
-  foreach ($map as $property => $attribute) {
-    // If the key is numeric, the attribute name needs to be taken over.
-    if (is_int($property)) {
-      $property = '#' . $attribute;
-    }
-    // Do not overwrite already existing attributes.
-    if (isset($element[$property]) && !isset($element['#attributes'][$attribute])) {
-      $element['#attributes'][$attribute] = $element[$property];
-    }
-  }
+  Element::setAttributes($element, $map);
 }
 
 /**
diff --git a/core/lib/Drupal/Core/Render/Element.php b/core/lib/Drupal/Core/Render/Element.php
new file mode 100644
index 0000000..c3d2952
--- /dev/null
+++ b/core/lib/Drupal/Core/Render/Element.php
@@ -0,0 +1,162 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Core\Render\Element.
+ */
+
+namespace Drupal\Core\Render;
+
+/**
+ * Deals with drupal render elements.
+ */
+class Element {
+
+  /**
+   * Checks if the key is a property.
+   *
+   * @param string $key
+   *   The key to check.
+   *
+   * @return bool
+   *   TRUE of the key is a property, FALSE otherwise.
+   */
+  public static function property($key) {
+    return $key[0] == '#';
+  }
+
+  /**
+   * Gets properties of a structured array element (keys beginning with '#').
+   *
+   * @param array $element
+   *   An element array to return properties for.
+   *
+   * @return array
+   *   An array of property keys for the element.
+   */
+  public static function properties(array $element) {
+    return array_filter(array_keys($element), 'static::property');
+  }
+
+  /**
+   * Checks if the key is a child.
+   *
+   * @param string $key
+   *   The key to check.
+   *
+   * @return bool
+   *    TRUE if the element is a child, FALSE otherwise.
+   */
+  public static function child($key) {
+    return !isset($key[0]) || $key[0] != '#';
+  }
+
+  /**
+   * Identifies the children of an element array, optionally sorted by weight.
+   *
+   * The children of a element array are those key/value pairs whose key does
+   * not start with a '#'. See drupal_render() for details.
+   *
+   * @param $elements
+   *   The element array whose children are to be identified.
+   * @param $sort
+   *   Boolean to indicate whether the children should be sorted by weight.
+   *
+   * @return
+   *   The array keys of the element's children.
+   */
+  public static function children(array &$elements, $sort = FALSE) {
+    // Do not attempt to sort elements which have already been sorted.
+    $sort = isset($elements['#sorted']) ? !$elements['#sorted'] : $sort;
+
+    // Filter out properties from the element, leaving only children.
+    $children = array();
+    $sortable = FALSE;
+    foreach ($elements as $key => $value) {
+      if ($key === '' || $key[0] !== '#') {
+        if (is_array($value)) {
+          $children[$key] = $value;
+          if (isset($value['#weight'])) {
+            $sortable = TRUE;
+          }
+        }
+        // Only trigger an error if the value is not null.
+        // @see http://drupal.org/node/1283892
+        elseif (isset($value)) {
+          trigger_error(t('"@key" is an invalid render array key', array('@key' => $key)), E_USER_ERROR);
+        }
+      }
+    }
+    // Sort the children if necessary.
+    if ($sort && $sortable) {
+      uasort($children, 'Drupal\Component\Utility\SortArray::sortByWeightProperty');
+      // Put the sorted children back into $elements in the correct order, to
+      // preserve sorting if the same element is passed through
+      // element_children() twice.
+      foreach ($children as $key => $child) {
+        unset($elements[$key]);
+        $elements[$key] = $child;
+      }
+      $elements['#sorted'] = TRUE;
+    }
+
+    return array_keys($children);
+  }
+
+  /**
+   * Returns the visible children of an element.
+   *
+   * @param $elements
+   *   The parent element.
+   *
+   * @return
+   *   The array keys of the element's visible children.
+   */
+  public static function getVisibleChildren(array $elements) {
+    $visible_children = array();
+
+    foreach (static::children($elements) as $key) {
+      $child = $elements[$key];
+
+      // Skip un-accessible children.
+      if (isset($child['#access']) && !$child['#access']) {
+        continue;
+      }
+
+      // Skip value and hidden elements, since they are not rendered.
+      if (isset($child['#type']) && in_array($child['#type'], array('value', 'hidden'))) {
+        continue;
+      }
+
+      $visible_children[$key] = $child;
+    }
+
+    return array_keys($visible_children);
+  }
+
+  /**
+   * Sets HTML attributes based on element properties.
+   *
+   * @param $element
+   *   The renderable element to process.
+   * @param $map
+   *   An associative array whose keys are element property names and whose values
+   *   are the HTML attribute names to set for corresponding the property; e.g.,
+   *   array('#propertyname' => 'attributename'). If both names are identical
+   *   except for the leading '#', then an attribute name value is sufficient and
+   *   no property name needs to be specified.
+   */
+  public static function setAttributes(array &$element, array $map) {
+    foreach ($map as $property => $attribute) {
+      // If the key is numeric, the attribute name needs to be taken over.
+      if (is_int($property)) {
+        $property = '#' . $attribute;
+      }
+      // Do not overwrite already existing attributes.
+      if (isset($element[$property]) && !isset($element['#attributes'][$attribute])) {
+        $element['#attributes'][$attribute] = $element[$property];
+      }
+    }
+  }
+
+}
diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/RenderWebTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/RenderWebTest.php
index 82da8e6..6fe96a8 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Common/RenderWebTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Common/RenderWebTest.php
@@ -152,7 +152,7 @@ function testDrupalRenderInvalidKeys() {
     $error = array(
       '%type' => 'User error',
       '!message' => '"child" is an invalid render array key',
-      '%function' => 'element_children()',
+      '%function' => 'Drupal\Core\Render\Element::children()',
     );
     $message = t('%type: !message in %function (line ', $error);
 
diff --git a/core/tests/Drupal/Tests/Core/Render/ElementTest.php b/core/tests/Drupal/Tests/Core/Render/ElementTest.php
new file mode 100644
index 0000000..2f55339
--- /dev/null
+++ b/core/tests/Drupal/Tests/Core/Render/ElementTest.php
@@ -0,0 +1,169 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Tests\Core\Render\ElementTest.
+ */
+
+namespace Drupal\Tests\Core\Render {
+
+use Drupal\Tests\UnitTestCase;
+use Drupal\Core\Render\Element;
+
+/**
+ * Tests the Element class
+ *
+ * @see \Drupal\Core\Render\Element
+ *
+ * @group Drupal
+ * @group Render
+ */
+class ElementTest extends UnitTestCase {
+
+  public static function getInfo() {
+    return array(
+      'name' => 'Element test',
+      'description' => 'Tests \Drupal\Core\Render\Element helper class.',
+      'group' => 'Render',
+    );
+  }
+
+  /**
+   * Tests the property() method.
+   */
+  public function testProperty() {
+    $this->assertTrue(Element::property('#property'));
+    $this->assertFalse(Element::property('property'));
+    $this->assertFalse(Element::property('property#'));
+  }
+
+  /**
+   * Tests the properties() method.
+   */
+  public function testProperties() {
+    $element = array(
+      '#property1' => 'property1',
+      '#property2' => 'property2',
+      'property3' => 'property3'
+    );
+
+    $properties = Element::properties($element);
+
+    $this->assertContains('#property1', $properties);
+    $this->assertContains('#property2', $properties);
+    $this->assertNotContains('property3', $properties);
+  }
+
+  /**
+   * Tests the child() method.
+   */
+  public function testChild() {
+    $this->assertFalse(Element::child('#property'));
+    $this->assertTrue(Element::child('property'));
+    $this->assertTrue(Element::child('property#'));
+  }
+
+  /**
+   * Tests the children() method.
+   */
+  public function testChildren() {
+    $element = array(
+      'child2' => array('#weight' => 10),
+      'child1' => array('#weight' => 0),
+      'child3' => array('#weight' => 20),
+      '#property' => 'property',
+    );
+
+    $expected = array('child2', 'child1', 'child3');
+    $element_copy = $element;
+    $this->assertSame($expected, Element::children($element_copy));
+
+    // If #sorted is already set, no sorting should happen.
+    $element_copy = $element;
+    $element_copy['#sorted'] = TRUE;
+    $expected = array('child2', 'child1', 'child3');
+    $this->assertSame($expected, Element::children($element_copy, TRUE));
+
+    // Test with weight sorting, #sorted property should be added.
+    $expected = array('child1', 'child2', 'child3');
+    $element_copy = $element;
+    $this->assertSame($expected, Element::children($element_copy, TRUE));
+    $this->assertArrayHasKey('#sorted', $element_copy);
+    $this->assertTrue($element_copy['#sorted']);
+
+    // The order should stay the same if no weights present.
+    $element_no_weight = array(
+      'child2' => array(),
+      'child1' => array(),
+      'child3' => array(),
+      '#property' => 'property',
+    );
+
+    $expected = array('child2', 'child1', 'child3');
+    $this->assertSame($expected, Element::children($element_no_weight, TRUE));
+  }
+
+  /**
+   * Tests the visibleChildren() method.
+   *
+   * @param array $element
+   *   The test element array.
+   * @param array $expected_keys
+   *   The expected keys to be returned from Element::getVisibleChildren().
+   *
+   * @dataProvider providerVisibleChildren
+   */
+  public function testVisibleChildren(array $element, array $expected_keys) {
+    $this->assertSame($expected_keys, Element::getVisibleChildren($element));
+  }
+
+  /**
+   * Data provider for testVisibleChildren.
+   *
+   * @return array
+   */
+  public function providerVisibleChildren() {
+    return array(
+      array(array('#property1' => '', '#property2' => array()), array()),
+      array(array('#property1' => '', 'child1' => array()), array('child1')),
+      array(array('#property1' => '', 'child1' => array(), 'child2' => array('#access' => TRUE)), array('child1', 'child2')),
+      array(array('#property1' => '', 'child1' => array(), 'child2' => array('#access' => FALSE)), array('child1')),
+      array(array('#property1' => '', 'child1' => array(), 'child2' => array('#type' => 'textfield')), array('child1', 'child2')),
+      array(array('#property1' => '', 'child1' => array(), 'child2' => array('#type' => 'value')), array('child1')),
+      array(array('#property1' => '', 'child1' => array(), 'child2' => array('#type' => 'hidden')), array('child1')),
+    );
+  }
+
+  /**
+   * Tests the setAttributes() method.
+   *
+   * @dataProvider providerTestSetAttributes
+   */
+  public function testSetAttributes($element, $map, $expected_element) {
+    Element::setAttributes($element, $map);
+    $this->assertSame($expected_element, $element);
+  }
+
+  /**
+   * Data provider for testSetAttributes().
+   */
+  public function providerTestSetAttributes() {
+    $base = array('#id' => 'id', '#class' => array());
+    return array(
+      array($base, array(), $base),
+      array($base, array('id', 'class'), $base + array('#attributes' => array('id' => 'id', 'class' => array()))),
+      array($base + array('#attributes' => array('id' => 'id-not-overwritten')), array('id', 'class'), $base + array('#attributes' => array('id' => 'id-not-overwritten', 'class' => array()))),
+    );
+  }
+
+}
+
+}
+
+namespace {
+  if (!function_exists('t')) {
+    function t($string) {
+      return $string;
+    }
+  }
+}
