I often think the same, I would actually like to find a better syntax too. I don't like suffices, others don't like special operators, etc., so it's unlikely we can find an alternative that will please everyone.

It feels that the majority of DOM nodes don't have attributes, so the current syntax is likely to stay but we are always open to alternatives.

BTW, you can easily redefine these HTML functions, or at least the ones you need the most with attributes, something like:

1
2
3
4
5
6
7
namespace WebSharper.UI.Next.Html

open WebSharper

[<JavaScript>]
module Alternative =
    let div atts els = divAttr atts els

This way, you can just bring these into scope after opening WebSharper.UI.Next.Html, or just instead of it:

1
2
3
4
5
open WebSharper.UI.Next.Html
open WebSharper.UI.Next.Html.Alternative
    
let stuff =
    div [...] [...]
By on 8/21/2015 2:56 PM ()

OK, that's what I shall do.

For what it's worth, div [] is one character shorter than divAttr :).

By on 8/25/2015 2:48 AM ()

Ignore that comment. It doesn't make sense for the situation where you don't want to specify any attributes.

Anyway, this other posting is related.

By on 8/28/2015 1:53 AM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper