MediaWiki master
|
Static utilities for manipulating HTML strings. More...
Static Public Member Functions | |
static | modifyElements (string $htmlFragment, callable $shouldModifyCallback, callable $modifyCallback, bool $html5format=true) |
Modify elements of an HTML fragment via a user-provided callback. | |
Static utilities for manipulating HTML strings.
Definition at line 16 of file HtmlHelper.php.
|
static |
Modify elements of an HTML fragment via a user-provided callback.
string | $htmlFragment | HTML fragment. Must be valid (ie. coming from the parser, not the user). |
callable | $shouldModifyCallback | A callback which takes a single RemexHtml\Serializer\SerializerNode argument, and returns true if it should be modified. |
callable | $modifyCallback | A callback which takes a single RemexHtml\Serializer\SerializerNode argument and actually performs the modification on it. It must return the new node (which can be the original node object). |
bool | $html5format | Defaults to true, which uses standard HTML5 serialization for the parsed HTML. If set to false, uses a serialization which is more compatible with the output of the legacy parser; see RemexCompatFormatter for more details. When false, attributes and text nodes contain unexpanded character references (entities). |
Definition at line 34 of file HtmlHelper.php.
References MediaWiki\Html\HtmlHelperTrait.