Tumblr 80666755
.
<div x-mojo-element="ToggleButton" id="my-toggle"></div>
A code example for using Palm’s Mojo framework in their otherwise awesome-looking new WebOS (from: Palm webOS from O’Reilly Media (page. 7)).
I ranted a bit about this on Twitter just now (1, 2, 3), because whilst the HTML5, CSS and JavaScript base of the WebOS platform is awesome, the extensions of the Mojo toolkit are a horrid kludge. For those skipping the Twitter links, the word I used for the above code snippet was ‘Psh’.
Namespaces. They’re not trendy any more. It turned out they were a rubbish idea for the web, not least because XHTML never got implemented, and then we realised we didn’t really need them anyway.
The thing is, WebOS is not the web. It is a standalone, walled off framework. Building things gracefully atop existing HTML elements is vital for the web because you must degrade gracefully, but using a toolkit for a native platform on a closed device is not the same.
I look at the above code example and my feeling is that they should be using XHTML5, and rather than add a custom x-mojo-blah
attribute to a div
, they should just namespace their toolkit: <mojo:togglebutton id="my-toggle" />
. That’s easy and obvious.
Bootstrapping an HTML div
is non-obvious.
If I were bootstrapping a toggle control onto an HTML _web_page, I’d be using a button
element, not a div
. Can I use a button
in WebOS? Can I override it to be a ToggleButton
? Looking at this example, I have no idea. Will I inherit some odd styling characteristics from WebKit like in a web browser? Will the behaviours conflict? These questions have answers, but I wouldn’t even be asking if this UI widget was namespaced.
Palm’s framework would be better with namespaces. The div
+attribute code is ugly, web developers will balk at the non-conforming custom attribute. Application programmers from other worlds and web developers will balk at it being an unoptimised, clunky way of specifying a control.
It’s a shame, because this syntax adds a layer of frustration to building for the Pre. We tolerate it on the web because of the benefits of pushing content across platforms, devices, and the wonderful, wild unknown of content consumption the web enables and thrives on. In the closed framework of WebOS, that compromise doesn’t share the upside. Via: developer.palm.com.
Links
To share this entry, or reference it in commentary of your own, link to the following:
- Permalink: https://benward.uk/blog/tumblr-80666755
- Shortlink: https://bnwrd.me/1aKGt0
You can file issues or provide corrections: View Source on Github. Contributor credits.