] [
"<!--comment-->" parse-html
] unit-test
+
+! Issue #1233, trailing / in tags
+{
+ V{
+ T{ tag
+ { name "img" }
+ { attributes H{ { "src" "http://factorcode.org" } } }
+ }
+ }
+}
+[ "<img src=\"http://factorcode.org\">" parse-html ] unit-test
+
+{
+ V{
+ T{ tag
+ { name "img" }
+ { attributes H{ { "src" "http://factorcode.org" } } }
+ }
+ }
+}
+[ "<img src=\"http://factorcode.org\"/>" parse-html ] unit-test
+
+{
+ V{
+ T{ tag
+ { name "img" }
+ { attributes H{ { "src" "http://factorcode.org" } } }
+ }
+ }
+}
+[ "<img src=\"http://factorcode.org\"////////>" parse-html ] unit-test
[ advance advance read-comment ] [ read-dtd ] if ;
: read-tag ( sequence-parser -- string )
- [ [ current "><" member? ] take-until ]
- [ dup current CHAR: < = [ advance ] unless drop ] bi ;
+ [
+ [ current "><" member? ] take-until
+ [ CHAR: / = ] trim-tail
+ ] [ dup current CHAR: < = [ advance ] unless drop ] bi ;
: read-until-< ( sequence-parser -- string )
[ current CHAR: < = ] take-until ;