diff --git a/core/lib/Drupal/Core/Template/Attribute.php b/core/lib/Drupal/Core/Template/Attribute.php
index 7833acc..ead5d05 100644
--- a/core/lib/Drupal/Core/Template/Attribute.php
+++ b/core/lib/Drupal/Core/Template/Attribute.php
@@ -112,11 +112,9 @@ public function offsetExists($name) {
   public function __toString() {
     $return = '';
     foreach ($this->storage as $name => $value) {
-      if (!$value->printed()) {
-        $rendered = $value->render();
-        if ($rendered) {
-          $return .= ' ' . $rendered;
-        }
+      $rendered = $value->render();
+      if ($rendered) {
+        $return .= ' ' . $rendered;
       }
     }
     return $return;
diff --git a/core/lib/Drupal/Core/Template/AttributeArray.php b/core/lib/Drupal/Core/Template/AttributeArray.php
index 38f216f..95e0ef3 100644
--- a/core/lib/Drupal/Core/Template/AttributeArray.php
+++ b/core/lib/Drupal/Core/Template/AttributeArray.php
@@ -66,7 +66,6 @@ public function offsetExists($offset) {
    * Implements the magic __toString() method.
    */
   public function __toString() {
-    $this->printed = TRUE;
     return String::checkPlain(implode(' ', $this->value));
   }
 
diff --git a/core/lib/Drupal/Core/Template/AttributeBoolean.php b/core/lib/Drupal/Core/Template/AttributeBoolean.php
index db444fd..4e9ea67 100644
--- a/core/lib/Drupal/Core/Template/AttributeBoolean.php
+++ b/core/lib/Drupal/Core/Template/AttributeBoolean.php
@@ -42,7 +42,6 @@ public function render() {
    * Implements the magic __toString() method.
    */
   public function __toString() {
-    $this->printed = TRUE;
     return $this->value === FALSE ? '' : String::checkPlain($this->name);
   }
 
diff --git a/core/lib/Drupal/Core/Template/AttributeString.php b/core/lib/Drupal/Core/Template/AttributeString.php
index a2a5514..07211be 100644
--- a/core/lib/Drupal/Core/Template/AttributeString.php
+++ b/core/lib/Drupal/Core/Template/AttributeString.php
@@ -30,7 +30,6 @@ class AttributeString extends AttributeValueBase {
    * Implements the magic __toString() method.
    */
   public function __toString() {
-    $this->printed = TRUE;
     return String::checkPlain($this->value);
   }
 
diff --git a/core/lib/Drupal/Core/Template/AttributeValueBase.php b/core/lib/Drupal/Core/Template/AttributeValueBase.php
index 6ccd339..73e6bee 100644
--- a/core/lib/Drupal/Core/Template/AttributeValueBase.php
+++ b/core/lib/Drupal/Core/Template/AttributeValueBase.php
@@ -17,13 +17,6 @@
 abstract class AttributeValueBase {
 
   /**
-   * Whether this attribute hsa been printed already.
-   *
-   * @var bool
-   */
-  protected $printed = FALSE;
-
-  /**
    * The value itself.
    *
    * @var mixed
@@ -61,16 +54,6 @@ public function render() {
   }
 
   /**
-   * Whether this attribute hsa been printed already.
-   *
-   * @return bool
-   *   TRUE if this attribute has been printed, FALSE otherwise.
-   */
-  public function printed() {
-    return $this->printed;
-  }
-
-  /**
    * Implements the magic __toString() method.
    */
   abstract function __toString();
diff --git a/core/modules/node/templates/node.html.twig b/core/modules/node/templates/node.html.twig
index 5bf5ad9..ae1162e 100644
--- a/core/modules/node/templates/node.html.twig
+++ b/core/modules/node/templates/node.html.twig
@@ -75,7 +75,7 @@
  * @ingroup themeable
  */
 #}
-<article id="node-{{ node.id }}" class="{{ attributes.class }} clearfix"{{ attributes }}>
+<article id="node-{{ node.id }}" class="{{ attributes.class }} clearfix"{{ attributes|without('id', 'class') }}>
 
   {{ title_prefix }}
   {% if not page %}
diff --git a/core/modules/system/lib/Drupal/system/Tests/Theme/TwigFilterTest.php b/core/modules/system/lib/Drupal/system/Tests/Theme/TwigFilterTest.php
index a80598c..9b514d7 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Theme/TwigFilterTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Theme/TwigFilterTest.php
@@ -8,6 +8,7 @@
 namespace Drupal\system\Tests\Theme;
 
 use Drupal\simpletest\WebTestBase;
+use Drupal\Core\Template\Attribute;
 
 /**
  * Tests Drupal's Twig filters.
@@ -19,9 +20,7 @@ class TwigFilterTest extends WebTestBase {
    *
    * @var array
    */
-  public static $modules = array(
-    'twig_theme_test',
-  );
+  public static $modules = array('twig_theme_test');
 
   /**
    * {@inheritdoc}
@@ -38,7 +37,21 @@ public static function getInfo() {
    * Test Twig "without" filter.
    */
   public function testTwigWithoutFilter() {
-    $this->drupalGet('/twig-theme-test/filter');
+    $filter_test = array(
+      '#theme' => 'twig_theme_test_filter',
+      '#quote' => array(
+        'content' => array('#markup' => 'You can only find truth with logic if you have already found truth without it.'),
+        'author' => array('#markup' => 'Gilbert Keith Chesterton'),
+        'date' => array('#markup' => '1874-1936'),
+      ),
+      '#attributes' => array(
+        'id' => 'quotes',
+        'checked' => TRUE,
+        'class' => array('red', 'green', 'blue'),
+      ),
+    );
+    $rendered = drupal_render($filter_test);
+    $this->drupalSetContent($rendered);
 
     $elements = array(
       array(
@@ -75,6 +88,38 @@ public function testTwigWithoutFilter() {
   </blockquote>',
         'message' => '"Marked-up quote" was successfully rendered.',
       ),
+      array(
+        'expected' => '<div><span id="quotes" checked class="red green blue">All attributes:</span></div>',
+        'message' => 'All attributes printed.',
+      ),
+      array(
+        'expected' => '<div><span class="red green blue" id="quotes" checked>Class attributes in front, remainder at the back:</span></div>',
+        'message' => 'Class attributes printed in the front, the rest in the back.',
+      ),
+      array(
+        'expected' => '<div><span id="quotes" checked data-class="red green blue">Class attributes in back, remainder at the front:</span></div>',
+        'message' => 'Class attributes printed in the back, the rest in the front.',
+      ),
+      array(
+        'expected' => '<div><span class="red green blue">Class attributes only:</span></div>',
+        'message' => 'Class attributes only printed.',
+      ),
+      array(
+        'expected' => '<div><span checked id="quotes" class="red green blue">Without boolean attribute.</span></div>',
+        'message' => 'Boolean attribute printed in the front.',
+      ),
+      array(
+        'expected' => '<div><span data-id="quotes" checked class="red green blue">Without string attribute.</span></div>',
+        'message' => 'Without string attribute in the front.',
+      ),
+      array(
+        'expected' => '<div><span checked>Without either nor class attributes.</span></div>',
+        'message' => 'Attributes printed without id nor class attributes.',
+      ),
+      array(
+        'expected' => '<div><span id="quotes" checked class="red green blue">All attributes again.</span></div>',
+        'message' => 'All attributes printed again.',
+      ),
     );
 
     foreach ($elements as $element) {
diff --git a/core/modules/system/tests/modules/twig_theme_test/lib/Drupal/twig_theme_test/TwigThemeTestController.php b/core/modules/system/tests/modules/twig_theme_test/lib/Drupal/twig_theme_test/TwigThemeTestController.php
index ba2a718..45654ea 100644
--- a/core/modules/system/tests/modules/twig_theme_test/lib/Drupal/twig_theme_test/TwigThemeTestController.php
+++ b/core/modules/system/tests/modules/twig_theme_test/lib/Drupal/twig_theme_test/TwigThemeTestController.php
@@ -28,19 +28,4 @@ public function transBlockRender() {
     );
   }
 
-  /**
-   * Menu callback for filters in a Twig template.
-   */
-  public function testFilterRender() {
-    return array(
-      '#theme' => 'twig_theme_test_filter',
-      '#quote' => array(
-        'content' => array('#markup' => 'You can only find truth with logic if you have already found truth without it.'),
-        'author' => array('#markup' => 'Gilbert Keith Chesterton'),
-        'date' => array('#markup' => '1874-1936'),
-      ),
-    );
-  }
-
 }
-
diff --git a/core/modules/system/tests/modules/twig_theme_test/templates/twig_theme_test.filter.html.twig b/core/modules/system/tests/modules/twig_theme_test/templates/twig_theme_test.filter.html.twig
index ce4c405..28e5c15 100644
--- a/core/modules/system/tests/modules/twig_theme_test/templates/twig_theme_test.filter.html.twig
+++ b/core/modules/system/tests/modules/twig_theme_test/templates/twig_theme_test.filter.html.twig
@@ -12,3 +12,11 @@
     </footer>
   </blockquote>
 </div>
+<div><span{{ attributes }}>All attributes:</span></div>
+<div><span class="{{ attributes.class }}"{{ attributes|without('class') }}>Class attributes in front, remainder at the back:</span></div>
+<div><span{{ attributes|without('class') }} data-class="{{ attributes.class }}">Class attributes in back, remainder at the front:</span></div>
+<div><span class="{{ attributes.class }}">Class attributes only:</span></div>
+<div><span {{ attributes.checked }}{{ attributes|without('checked') }}>Without boolean attribute.</span></div>
+<div><span data-id="{{ attributes.id }}"{{ attributes|without('id') }}>Without string attribute.</span></div>
+<div><span{{ attributes|without('id', 'class') }}>Without either nor class attributes.</span></div>
+<div><span{{ attributes }}>All attributes again.</span></div>
diff --git a/core/modules/system/tests/modules/twig_theme_test/twig_theme_test.module b/core/modules/system/tests/modules/twig_theme_test/twig_theme_test.module
index 5a9f095..5874cca 100644
--- a/core/modules/system/tests/modules/twig_theme_test/twig_theme_test.module
+++ b/core/modules/system/tests/modules/twig_theme_test/twig_theme_test.module
@@ -5,7 +5,7 @@
  */
 function twig_theme_test_theme($existing, $type, $theme, $path) {
   $items['twig_theme_test_filter'] = array(
-    'variables' => array('quote' => array()),
+    'variables' => array('quote' => array(), 'attributes' => array()),
     'template' => 'twig_theme_test.filter',
   );
   $items['twig_theme_test_php_variables'] = array(
diff --git a/core/modules/system/tests/modules/twig_theme_test/twig_theme_test.routing.yml b/core/modules/system/tests/modules/twig_theme_test/twig_theme_test.routing.yml
index c187bc2..96befd4 100644
--- a/core/modules/system/tests/modules/twig_theme_test/twig_theme_test.routing.yml
+++ b/core/modules/system/tests/modules/twig_theme_test/twig_theme_test.routing.yml
@@ -11,10 +11,3 @@ twig_theme_test.trans:
     _content: '\Drupal\twig_theme_test\TwigThemeTestController::transBlockRender'
   requirements:
     _access: 'TRUE'
-
-twig_theme_test.filter:
-  path: '/twig-theme-test/filter'
-  defaults:
-    _content: '\Drupal\twig_theme_test\TwigThemeTestController::testFilterRender'
-  requirements:
-    _access: 'TRUE'
diff --git a/core/themes/bartik/templates/comment.html.twig b/core/themes/bartik/templates/comment.html.twig
index ea320b9..bbb7c5b 100644
--- a/core/themes/bartik/templates/comment.html.twig
+++ b/core/themes/bartik/templates/comment.html.twig
@@ -62,7 +62,7 @@
  * @see template_preprocess_comment()
  */
 #}
-<article class="{{ attributes.class }} clearfix"{{ attributes }} role="article">
+<article class="{{ attributes.class }} clearfix"{{ attributes|without('class') }} role="article">
 
   <header class="comment-header">
     <div class="attribution">
diff --git a/core/themes/bartik/templates/field--taxonomy-term-reference.html.twig b/core/themes/bartik/templates/field--taxonomy-term-reference.html.twig
index 59cd35e..fad1ed7 100644
--- a/core/themes/bartik/templates/field--taxonomy-term-reference.html.twig
+++ b/core/themes/bartik/templates/field--taxonomy-term-reference.html.twig
@@ -16,7 +16,7 @@
  * @see bartik_preprocess_field()
  */
 #}
-<div class="{{ attributes.class }} clearfix"{{ attributes }}>
+<div class="{{ attributes.class }} clearfix"{{ attributes|without('class') }}>
   <h3{{ label_attributes }}>{{ label }}: </h3>
   <ul class="links">
     {% for delta, item in items %}
diff --git a/core/themes/bartik/templates/node.html.twig b/core/themes/bartik/templates/node.html.twig
index 6afb107..2848899 100644
--- a/core/themes/bartik/templates/node.html.twig
+++ b/core/themes/bartik/templates/node.html.twig
@@ -69,7 +69,7 @@
  * @see template_preprocess_node()
  */
 #}
-<article id="node-{{ node.id }}" class="{{ attributes.class}} clearfix"{{ attributes }} role="article">
+<article id="node-{{ node.id }}" class="{{ attributes.class }} clearfix" role="article"{{ attributes|without('id', 'class', 'role') }}>
 
   <header>
     {{ title_prefix }}
diff --git a/core/themes/engines/twig/twig.engine b/core/themes/engines/twig/twig.engine
index d596715..1595bf8 100644
--- a/core/themes/engines/twig/twig.engine
+++ b/core/themes/engines/twig/twig.engine
@@ -164,7 +164,12 @@ function twig_render_var($arg) {
  *   The filtered renderable array.
  */
 function twig_without($element) {
-  $filtered_element = $element;
+  if ($element instanceof ArrayAccess) {
+    $filtered_element = clone $element;
+  }
+  else {
+    $filtered_element = $element;
+  }
   $args = func_get_args();
   unset($args[0]);
   foreach ($args as $arg) {
