Open MohideenSheikSulaiman opened 4 years ago
@MohideenSheikSulaiman hey there. The behaviour is correct, custom elements can't be self-closing. In this case the parser tries to guess the correct nesting of the custom elements, and you get the second <MyTag>
inside the first one. According to the HTML spec only some specified elements can be self-closing (void elements & foreign).
Take a look here: HTML Elements Syntax. The void elements are: area, base, br, col, embed, hr, img, input, link, meta, param, source, track, wbr
You can put your html in a file and open it in any browser you like, chrome, firefox ..etc. All of them will behave the same. Here is chrome for example doing the same:
@iabudiab Thanks for the info. We are using custom self-closing tags in the HTML to transfer the content between the devices. When we parse the HTML, we convert the custom tags to the defined HTML elements. So the above case creates a problem. Data loss happens.
It will be better if you can provide a custom tags support along with the (The void elements are: area, base, br, col, embed, hr, img, input, link, meta, param, source, track, wbr).
Is it possible to provide an option to pass the custom self-closing tags as an input to the parser.?
@iabudiab
Hi,
I have an issue with HTML-Kit. When I parse an HTML content which has few self-closing custom tags, it is not detected properly.
Here is the sample code,
NSArray *images = [self.document querySelectorAll:@"MyTag"];
Pls, see the array results in below image