Login Register

Understanding Widget Renderers

Implementations

Widgets can have (but are not required to have) multiple implementations, as follows:

  • svg - will run on any svg enabled browser (FF, later safari, soon other browsers)
  • vml - will run on IE
  • html - can run on any browser

Note that the so-called "html" version of the widget might actually run special code for IE, FF, etc., either through calls to utility functions (such as the graphics library) that branch based on browser version, or "if/else" statements, or whatever.

Which widget gets run?

The HTML file just specifies the widget name, without specifying the implementation. For example,

<div dojoType="Foo">


Dojo will pick which version of the widget to run based on the user's browser and what versions of the widget are available. For example, on IE, it will run dojo.widget.vml.Foo if it exists, and otherwise run dojo.widget.html.Foo.

Modules for Implementations

There are three separate modules, corresponding to the implementations above:

  • dojo.widget.svg
  • dojo.widget.vml
  • dojo.widget.html

Examples:

1. The Button widget only has a single "html" implementation. It's defined in dojo.widget.html.Button



2. In the future, the Chart widget will have both "svg" and "vml" implementations, defined in dojo.widget.svg.Chart and dojo.widget.vml.Chart. (The widget doesn't instantiate at all on browsers that don't match either svg or vml) Author: the stick