File tree 1 file changed +13
-0
lines changed
1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 2
2
3
3
namespace ipl \Html ;
4
4
5
+ use ReflectionException ;
5
6
use RuntimeException ;
6
7
7
8
/**
@@ -75,6 +76,9 @@ abstract class BaseHtmlElement extends HtmlDocument
75
76
/** @var string Tag of element. Set this property in order to provide the element's tag when extending this class */
76
77
protected $ tag ;
77
78
79
+ /** @var self */
80
+ private $ selfRef ;
81
+
78
82
/**
79
83
* Get the attributes of the element
80
84
*
@@ -83,6 +87,8 @@ abstract class BaseHtmlElement extends HtmlDocument
83
87
public function getAttributes ()
84
88
{
85
89
if ($ this ->attributes === null ) {
90
+ $ this ->selfRef = $ this ;
91
+
86
92
$ default = $ this ->getDefaultAttributes ();
87
93
if (empty ($ default )) {
88
94
$ this ->attributes = new Attributes ();
@@ -353,12 +359,19 @@ public function renderUnwrapped()
353
359
);
354
360
}
355
361
362
+ /**
363
+ * @throws ReflectionException
364
+ */
356
365
public function __clone ()
357
366
{
358
367
parent ::__clone ();
359
368
360
369
if ($ this ->attributes !== null ) {
361
370
$ this ->attributes = clone $ this ->attributes ;
371
+
372
+ $ this ->attributes ->rebind ($ this ->selfRef , $ this );
362
373
}
374
+
375
+ $ this ->selfRef = $ this ;
363
376
}
364
377
}
You can’t perform that action at this time.
0 commit comments