Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
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.
  • Loading branch information
mallardduck authored Dec 28, 2016
commit 43086dfdf5b4b8045d3b56b55b312b6762f65a41
10 changes: 9 additions & 1 deletion src/PHPHtmlParser/Dom/AbstractNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,9 @@ public function setAttribute($key, $value)
{
$this->tag->setAttribute($key, $value);

//clear any cache
$this->clear();

return $this;
}

Expand All @@ -318,6 +321,9 @@ public function setAttribute($key, $value)
public function removeAttribute($key)
{
$this->tag->removeAttribute($key);

//clear any cache
$this->clear();
}

/**
Expand All @@ -329,8 +335,10 @@ public function removeAttribute($key)
public function removeAllAttributes()
{
$this->tag->removeAllAttributes();

//clear any cache
$this->clear();
}

/**
* Function to locate a specific ancestor tag in the path to the root.
*
Expand Down