Skip to content

Commit 43086df

Browse files
authored
Run clear() on attribute changes
This change will run the clear() function to empty any caches if an attribute has been changed, added, or removed.
1 parent 9663472 commit 43086df

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/PHPHtmlParser/Dom/AbstractNode.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,9 @@ public function setAttribute($key, $value)
305305
{
306306
$this->tag->setAttribute($key, $value);
307307

308+
//clear any cache
309+
$this->clear();
310+
308311
return $this;
309312
}
310313

@@ -318,6 +321,9 @@ public function setAttribute($key, $value)
318321
public function removeAttribute($key)
319322
{
320323
$this->tag->removeAttribute($key);
324+
325+
//clear any cache
326+
$this->clear();
321327
}
322328

323329
/**
@@ -329,8 +335,10 @@ public function removeAttribute($key)
329335
public function removeAllAttributes()
330336
{
331337
$this->tag->removeAllAttributes();
338+
339+
//clear any cache
340+
$this->clear();
332341
}
333-
334342
/**
335343
* Function to locate a specific ancestor tag in the path to the root.
336344
*

0 commit comments

Comments
 (0)