Permalink
Browse files

[fix] xhtml.opa: improved the handle_xhtml function, in order to merg…

…e href attribute and the specific_attribute href field
  • Loading branch information...
1 parent 1ad0ca5 commit 155f1eb1669309468caf7f6cfe10ccd1e99b0c7b @Aqua-Ye Aqua-Ye committed Oct 20, 2011
Showing with 14 additions and 1 deletion.
  1. +14 −1 stdlib/core/xhtml/xhtml.opa
@@ -796,6 +796,8 @@ Xhtml =
print_arg_with_spec_filter(acc, ~{name namespace=tagns value}) =
if name == "class" then
{ acc with class = [value|acc.class] }
+ else if name == "href" then
+ { acc with href = {untyped=value} }
else
do print_arg({~name namespace=tagns ~value})
acc
@@ -812,7 +814,18 @@ Xhtml =
do List.iter((name -> do Buf.add(html_buffer," ") Buf.add(html_buffer,name)),t)
Buf.add(html_buffer,"\"")
end
- void
+ href_opt = match xhtml_spec_attrs.href with
+ {none} -> none
+ {~constant} -> some(constant)
+ {~untyped} ->
+ if Uri.is_secure(untyped) then some(untyped) //URI was accepted, return original URI
+ else some(sanitized_uri) //URI was rejected, replace by default URI
+ {~typed} -> some(Uri.to_string(typed))
+ end
+ match href_opt
+ {some=href} -> print_arg({name="href" namespace="" value=href})
+ {none} -> void
+ end
| {some=~{class style events events_options href}} ->
//Normalize tags
do (

0 comments on commit 155f1eb

Please sign in to comment.