Blog

Jan 22

Dojo FAQ: How does passing a configuration object to require work?

By on January 22, 2014 10:04 am

DojoFAQ
Anyone who has developed applications with Dojo’s AMD loader will have used the require function to asynchronously load modules. Must of the time, a require call takes the form require(['path1', 'path2'], function(module1, module2) { ... });. However, require will also accept an optional parameter before the path list, a configuration object. This object configures the Dojo loader, much like the global dojoConfig property or data-dojo-config attribute.

Dec 3

A SitePen Christmas Special

By on December 3, 2013 8:00 am

What a great year 2013 has been!

We’re feeling (collectively) like Ebenezer Scrooge in the final chapters of Charles Dickens’ A Christmas Carol – except we haven’t been jerks up ’til now and we think working at SitePen is a year-round Christmas vacation, unlike the earlier chapters wherein Scrooge forces poor Mr. Cratchit to work by the heat of a candle. That’s just mean. Anyways, the point is, we’re feeling fairly festive and because of this, we have something special for you!

Free-Dojo-Promo-01

Sign up today and get Dojo 101 for FREE

We would like to give you a FREE pass to our Dojo 101: Fundamentals workshop (a $649 value!) when you sign up for Dojo 201: Interfaces or Dojo 202: Architecture. All you have to do is register before December 31, 2013 for any 2014 workshop and enter promo code FREE101!

The simple act of writing this blog is warming the cockles of my heart. I can’t help myself – I want to give more! How about this? The first person to register for 101 and 201 in each city, will get both workshops for FREE!

Come learn with us in 2014! Let us impart our knowledge by giving you the gifts of enlightened web development and broadened horizons!

Sign Up Today!

Nov 5

Dojo FAQ: Why is there an underscore before some module names?

By on November 5, 2013 11:51 am

In general, Dojo uses the following naming conventions:

  • _UpperCamelCase: mixin classes/modules
  • UpperCamelCase: base classes or constructors to instantiate
  • _lowerCamelCase: private/protected vars, or internal methods that may change between point releases (not typically used for a module name)
  • lowerCamelCase: singletons (or normal methods when used within a module)
  • _base: modules that were historically included in the default Dojo base build
Nov 1

Dojo FAQ: Does dojo/query return elements in the same order as they appear in the DOM?

By on November 1, 2013 9:57 am

xstyle_transparentThe short answer is: no, dojo/query is not guaranteed to return elements in the same order as they appear in the DOM.

Dojo’s query module is designed to use the DOM’s querySelectorAll method, if available. Otherwise, it uses a CSS selector library. While querySelectorAll does return elements in order, the selector engines provided with Dojo (dojo/selector/acme and dojo/selector/lite) have been optimized for speed without strict adherence to element order. This means you may often find that they return elements in order, but this is not guaranteed.

Sep 10

Building an application with xstyle

By on September 10, 2013 11:10 am
This entry is part 3 of 4 in the series Getting to Know xstyle

xstyle_transparentIn this post, we want to walk through how you would get started building an application using xstyle, an extensible CSS framework. xstyle provides extensions that allows us to declaratively describe an user interface, making use of data bindings, element generation, and components, giving us an elegant means to create an application. In this tutorial, we will be using xstyle with Dojo, and use xstyle completely for our UI. Before starting, remember that you can use xstyle to any degree desired. xstyle can simply be used to make CSS improvements, it can build more sophisticated UI components, and it can be used to describe the entirety of the user interface (combined with a JavaScript-driven data model). Here we will be looking at the application level usage of xstyle, and we will create an app with a simple list of contacts and a form to edit the contact.

Aug 27

Dojo FAQ: Why don’t object stores always return a promise?

By on August 27, 2013 12:27 pm

When getting started with Dojo’s store API, it is important to realize that not all stores are created equal. Some stores, such as the JsonRest store, communicate with a server for every request, and each of their methods return a promise resolving when the asynchronous request completes. Others, such as the Memory store, can perform their logic synchronously, so their methods return immediate values.

This variance in the nature of store method return values can present a challenge when trying to write code that can work with any type of store. Fortunately, Dojo has tools to help in precisely this situation.

May 22

Dojo FAQ: Why doesn’t my mouse event have pageX/Y or layerX/Y? Doesn’t Dojo normalize events?

By on May 22, 2013 12:30 pm

Position properties on mouse events

The W3 specification for DOM events includes clientX/Y and screenX/Y properties on MouseEvents, but pageX/Y, layerX/Y, and offsetX/Y are non-standard properties. They are occasionally useful though and have fairly widespread browser support, even if they are a bit inconsistent.

The chief danger is with layerX/Y and offsetX/Y. They should report the position of the cursor relative to the origin of the closest enclosing element that is positioned, but not all browsers agree on what qualifies as a “positioned” element.