Skip to content

Commit

Permalink
Update HTMLNode.php
Browse files Browse the repository at this point in the history
  • Loading branch information
usernane committed May 17, 2023
1 parent 49f1683 commit 4a29272
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion webfiori/ui/HTMLNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,31 @@ public static function fromFile(string $absPath, array $slotsOrVars = []) {

return $compiler->getCompiled();
}

/**
* Creates HTMLNode object given a string of HTML code.
*
* Note that this method is still under implementation.
*
* @param string $htmlTxt A string that represents HTML code.
*
* @param bool $asHTMLDocObj If set to 'true' and given HTML represents a
* structured HTML document, the method will convert the code to an object
* of type 'HTMLDoc'. Default is 'true'.
*
* @return array|HeadNode|HTMLDoc|HTMLNode If the given code represents HTML document
* and the parameter <b>$asHTMLDocObj</b> is set to 'true', an object of type
* 'HTMLDoc' is returned. If the given code has multiple top level nodes
* (e.g. '&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;'),
* an array that contains an objects of type 'HTMLNode' is returned. If the
* given code has one top level node, an object of type 'HTMLNode' is returned.
* Note that it is possible that the method will return an instance which
* is a subclass of the class 'HTMLNode'.
*
* @throws InvalidNodeNameException
*/
public static function fromHTML(string $htmlTxt, bool $asHTMLDocObj = true) {
return TemplateCompiler::fromHTMLText($htmlTxt, $asHTMLDocObj);
}
/**
* Returns the value of an attribute.
*
Expand Down

0 comments on commit 4a29272

Please sign in to comment.