kartograph/kartograph.js — Issue #7: Add CSS parser for IE
Author: gka
Created: 2012-01-08 20:21:05+00:00
State: open

For getting IE support (#6) it is required to parse CSS in JavaScript. The following styles will be parsed and applied via Raphael's attr() method:

* fill
* fill-opacity
* stroke
* stroke-width
* stroke-opacity
* stroke-linejoin

(more to come eventually)

To achieve styling, the Kartograph.Map constructor accepts an additional parameter which is the stylesheet for the map.

new kartograph.Map('#map', 'mapstyles.css');

For non-IE browsers, the styles are simply included via tag. On IE, the styles will be parsed by Kartograph and then stored for later use.

Internally, Kartograph.Map gets a new method that applies all styles:

map.applyStyles(raphaelNode)

The CSS parser comes from http://bililite.com/blog/2009/01/16/jquery-css-parser/