net.html: add note to parse and parse_file, that they will produce a DOM with lowercased tag names (#19720)

This commit is contained in:
Marco Santos 2023-11-01 10:28:21 +00:00 committed by GitHub
parent adb46ff645
commit cee947ca9e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,6 +3,8 @@ module html
import os import os
// parse parses and returns the DOM from the given text. // 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 { pub fn parse(text string) DocumentObjectModel {
mut parser := Parser{} mut parser := Parser{}
parser.parse_html(text) parser.parse_html(text)
@ -10,6 +12,8 @@ pub fn parse(text string) DocumentObjectModel {
} }
// parse_file parses and returns the DOM from the contents of a file. // 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 { pub fn parse_file(filename string) DocumentObjectModel {
content := os.read_file(filename) or { return DocumentObjectModel{ content := os.read_file(filename) or { return DocumentObjectModel{
root: &Tag{} root: &Tag{}