File tree Expand file tree Collapse file tree 2 files changed +62
-2
lines changed
main/java/org/exist/util/serializer Expand file tree Collapse file tree 2 files changed +62
-2
lines changed Original file line number Diff line number Diff line change @@ -141,8 +141,6 @@ public class HTML5Writer extends XHTML5Writer {
141
141
static {
142
142
RAW_TEXT_ELEMENTS .add ("script" );
143
143
RAW_TEXT_ELEMENTS .add ("style" );
144
- RAW_TEXT_ELEMENTS .add ("textarea" );
145
- RAW_TEXT_ELEMENTS .add ("title" );
146
144
}
147
145
148
146
public HTML5Writer () {
Original file line number Diff line number Diff line change @@ -865,3 +865,65 @@ function ser:serialize-xml-134() {
865
865
}
866
866
return serialize ((1 to 4 )!text {.}, $params)
867
867
};
868
+
869
+ declare
870
+ %test:assertEquals('<!DOCTYPE html> <option selected></option>' )
871
+ function ser:serialize-html-5-boolean-attribute-names () {
872
+ let $params := map {
873
+ "method" : "html" ,
874
+ "html-version" : 5.0
875
+ }
876
+ return
877
+ <option selected = "selected" />
878
+ => serialize ($params)
879
+ => normalize-space ()
880
+ };
881
+
882
+ declare
883
+ %test:assertEquals('<!DOCTYPE html> <br>' )
884
+ function ser:serialize-html-5-empty-tags () {
885
+ let $params := map {
886
+ "method" : "html" ,
887
+ "html-version" : 5.0
888
+ }
889
+ return
890
+ <br/>
891
+ => serialize ($params)
892
+ => normalize-space ()
893
+ };
894
+
895
+ declare
896
+ %test:assertEquals('<!DOCTYPE html> <foo><style>ul > li { color:red; }</style><script>if (a < b) foo()</script></foo>' )
897
+ function ser:serialize-html-5-raw-text-elements () {
898
+ let $params := map {
899
+ "method" : "html" ,
900
+ "html-version" : 5.0
901
+ }
902
+ return
903
+ <foo>
904
+ <style>{``[ul > li {
905
+ color:red;
906
+ }]``}</style>
907
+ <script>{``[if (a < b) foo ()]``}</script>
908
+ </foo>
909
+ => serialize ($params)
910
+ => normalize-space ()
911
+ };
912
+
913
+ declare
914
+ %test:assertEquals('<!DOCTYPE html> <foo><title>ul & gt; li { color:red; }</title><textarea>if (a & lt; b) foo()</textarea></foo>' )
915
+ function ser:serialize-html-5-needs-escape-elements () {
916
+ let $params := map {
917
+ "method" : "html" ,
918
+ "html-version" : 5.0
919
+ }
920
+ return
921
+ <foo>
922
+ <title>{``[ul > li {
923
+ color:red;
924
+ }]``}</title>
925
+ <textarea>{``[if (a < b) foo ()]``}</textarea>
926
+ </foo>
927
+ => serialize ($params)
928
+ => normalize-space ()
929
+ };
You can’t perform that action at this time.
0 commit comments