dojo/uacss

since:v1.4

dojo/uacss adds browser “centric” CSS classes to a the document’s <html> tag. This is mainly used to be able to easily apply browser specific CSS styles, working around browser limitations and quirks.

Usage

In order to have the appropriate classes added to your document, just load the module:

require(["dojo/uacss"], function(){
  // do something...
});

Then provide CSS rules that leverage the classes:

.dj_ie6 h1 {
  font-size: 24px;
}

Note If you are relying on the styles to be set before running code, just using the dojo/domReady! loader plugin is not necessarily sufficient and you should wrap any code that relies upon the styles in a dojo/ready callback. This is because dojo/uacss also has to load after the DOM is ready and registers itself to load before other dojo/ready callbacks. For example:

require(["dojo/ready", "dojo/uacss"], function(ready){
  ready(function(){
    // do something reliant upon dojo/uacss
  });
});

There is no need to provide a variable in the callback function for dojo/uacss. The module will return an alias to dojo/has.

There are several different features that are detected and classes that are added to the document:

Category CSS Class Notes
Browser and Version

dj_ie

dj_ie6

dj_ie7

dj_ie8

dj_ie9

dj_opera

dj_khtml

dj_safari

dj_chrome

dj_ff3

Internet Explorer

Internet Explorer v6

Internet Explorer v7

Internet Explorer v8

Internet Explorer v9

Opera

KHTML

Safari

Chrome

Firefox version 3.X (incuding 3.5 and 3.6)

Browser Category

dj_webkit

dj_gecko

Any webkit based browser (notably Google Chrome and Safari)

Any Mozilla based browser (notably Firefox)

Broswer Functionality

dj_quirks

dj_iequirks

dj_contentBox

dj_borderBox

Browser is running in quirks mode rather than standards mode

Internet Explorer is running in quirks mode

Standard Sizing (where style size refers to content box)

Where style sizing includes the size of padding and border

BIDI

dj_rtl

dj_ie-rtl

dj_borderBox-rtl

If the document is in the right-to-left mode, the dj_rtl class is added, plus other classes with a -rtl added on to them will also be added.

See Also

Table of Contents

Error in the documentation? Can’t find what you are looking for? Let us know!