Skip to content

Commit

Permalink
net.html: add note to parse and parse_file, that they will produce a …
Browse files Browse the repository at this point in the history
…DOM with lowercased tag names (#19720)
  • Loading branch information
marcosantos98 committed Nov 1, 2023
1 parent adb46ff commit cee947c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions vlib/net/html/html.v
Expand Up @@ -3,13 +3,17 @@ module html
import os

// parse parses and returns the DOM from the given text.
// Note: this function will parse all tags to lowercase.
// E.g. <MyTag>content<MyTag/> is converted to <mytag>content<mytag>
pub fn parse(text string) DocumentObjectModel {
mut parser := Parser{}
parser.parse_html(text)
return parser.get_dom()
}

// parse_file parses and returns the DOM from the contents of a file.
// Note: this function will parse all tags to lowercase.
// E.g. <MyTag>content<MyTag/> is converted to <mytag>content<mytag>
pub fn parse_file(filename string) DocumentObjectModel {
content := os.read_file(filename) or { return DocumentObjectModel{
root: &Tag{}
Expand Down

0 comments on commit cee947c

Please sign in to comment.