File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33namespace ipl \Html ;
44
5+ use ReflectionException ;
56use RuntimeException ;
67
78/**
@@ -75,6 +76,9 @@ abstract class BaseHtmlElement extends HtmlDocument
7576 /** @var string Tag of element. Set this property in order to provide the element's tag when extending this class */
7677 protected $ tag ;
7778
79+ /** @var self */
80+ private $ selfRef ;
81+
7882 /**
7983 * Get the attributes of the element
8084 *
@@ -83,6 +87,8 @@ abstract class BaseHtmlElement extends HtmlDocument
8387 public function getAttributes ()
8488 {
8589 if ($ this ->attributes === null ) {
90+ $ this ->selfRef = $ this ;
91+
8692 $ default = $ this ->getDefaultAttributes ();
8793 if (empty ($ default )) {
8894 $ this ->attributes = new Attributes ();
@@ -353,12 +359,19 @@ public function renderUnwrapped()
353359 );
354360 }
355361
362+ /**
363+ * @throws ReflectionException
364+ */
356365 public function __clone ()
357366 {
358367 parent ::__clone ();
359368
360369 if ($ this ->attributes !== null ) {
361370 $ this ->attributes = clone $ this ->attributes ;
371+
372+ $ this ->attributes ->rebind ($ this ->selfRef , $ this );
362373 }
374+
375+ $ this ->selfRef = $ this ;
363376 }
364377}
You can’t perform that action at this time.
0 commit comments