A mismatch between XHTML and HTML, it seems: the web browser, acting in
HTML mode, doesn't understand the empty <script/> tag but expects an
explicit closing tag. On the other hand, Erlang Web, thinking in XML,
doesn't understand what's wrong with using an empty tag here. This also
happens for <textarea/>.
I think this could be prevented in wpart_xs:export_tag/3, by making sure
that certain tags are never output in empty form. Something like this:
diff -r db49a124b962 lib/wpart-1.4/src/wpart_xs.erl
--- a/lib/wpart-1.4/src/wpart_xs.erl Wed Oct 28 11:02:05 2009 +0100
+++ b/lib/wpart-1.4/src/wpart_xs.erl Mon Nov 02 13:30:19 2009 +0000
@@ -76,7 +76,15 @@
-spec(export_tag/3 :: (atom(), list(tuple()), list()) -> list(string()) | string()).
export_tag(Name, Attributes, []) ->
- [$<, atom_to_list(Name), export_attributes(Attributes), $/,$>];
+ % HTML processors would choke on these tags if output in XML empty-element style.
+ MustNotBeEmpty = [script, textarea],
+ case lists:member(Name, MustNotBeEmpty) of
+ true ->
+ [$<, atom_to_list(Name), export_attributes(Attributes),$>,
+ $<, $/, atom_to_list(Name), $>];
+ false ->
+ [$<, atom_to_list(Name), export_attributes(Attributes), $/,$>]
+ end;
export_tag(Name, Attributes, Content) ->
StrName = atom_to_list(Name),
[$<, StrName, export_attributes(Attributes),$>,
--
Magnus Henoch, mag...@erlang-consulting.com
Erlang Training and Consulting
http://www.erlang-consulting.com/
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Erlangweb-users mailing list
Erlangweb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlangweb-users
http://www.erlang-web.org/