├── has-class.js ├── package.json ├── package.js ├── .jshintrc ├── load-css.js ├── css.js ├── README.md ├── load-imports.js ├── LICENSE └── parser.js /has-class.js: -------------------------------------------------------------------------------- 1 | define(['dojo/has'], function(has){ 2 | var tested = {}; 3 | return function(){ 4 | var test, args = arguments; 5 | for(var i = 0; i < args.length; i++){ 6 | var test = args[i]; 7 | if(!tested[test]){ 8 | tested[test] = true; 9 | var parts = test.match(/^(no-)?(.+?)((-[\d\.]+)(-[\d\.]+)?)?$/), // parse the class name 10 | hasResult = has(parts[2]), // the actual has test 11 | lower = -parts[4]; // lower bound if it is in the form of test-4 or test-4-6 (would be 4) 12 | // if it has a range boundary, compare to see if we are in it 13 | if((lower > 0 ? lower <= hasResult && (-parts[5] || lower) >= hasResult : 14 | !!hasResult) == !parts[1]){ // parts[1] is the no- prefix that can negate the result 15 | document.documentElement.className += ' has-' + test; 16 | } 17 | } 18 | } 19 | }; 20 | }); -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "xstyle", 3 | "author": "Kris Zyp", 4 | "version": "0.3.1", 5 | "description": "CSS framework providing polyfills, extensions, dynamic loading, and selector based DOM manipulation", 6 | "licenses": [ 7 | { 8 | "type": "AFLv2.1", 9 | "url": "http://trac.dojotoolkit.org/browser/dojo/trunk/LICENSE#L43" 10 | }, 11 | { 12 | "type": "BSD", 13 | "url": "http://trac.dojotoolkit.org/browser/dojo/trunk/LICENSE#L13" 14 | } 15 | ], 16 | "repository": { 17 | "type": "git", 18 | "url": "http://github.com/kriszyp/xstyle" 19 | }, 20 | "main": "./main", 21 | "icon": "http://packages.dojofoundation.org/images/xstyle.jpg", 22 | "dependencies": { 23 | "dojo": "^1.7.0" 24 | }, 25 | "dojoBuild": "package.js", 26 | "volo": { 27 | "type": "directory" 28 | }, 29 | "devDependencies": { 30 | "dojo": "^1.10.2" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /package.js: -------------------------------------------------------------------------------- 1 | var miniExcludes = { 2 | "xstyle/index.html": 1, 3 | "xstyle/README.md": 1, 4 | "xstyle/package": 1 5 | }, 6 | copyOnlyRe = [ 7 | /\/build/, // contents of build folder and build.js 8 | /\/core\/amdLoader/, // contents of core folder 9 | /\/core\/put/, // contents of core folder 10 | /\/xstyle(\.min)?$/ // xstyle.min.* 11 | ], 12 | isTestRe = /\/test\//; 13 | 14 | var profile = { 15 | resourceTags: { 16 | test: function(filename, mid){ 17 | return isTestRe.test(filename); 18 | }, 19 | 20 | miniExclude: function(filename, mid){ 21 | return isTestRe.test(filename) || mid in miniExcludes; 22 | }, 23 | 24 | amd: function(filename, mid){ 25 | return /\.js$/.test(filename); 26 | }, 27 | 28 | copyOnly: function(filename, mid){ 29 | for(var i = copyOnlyRe.length; i--;){ 30 | if(copyOnlyRe[i].test(mid)){ 31 | return true; 32 | } 33 | } 34 | return false; 35 | } 36 | } 37 | }; -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "asi": false, 3 | "bitwise": false, 4 | "boss": false, 5 | "browser": true, 6 | "camelcase": true, 7 | "couch": false, 8 | "curly": true, 9 | "debug": false, 10 | "devel": true, 11 | "dojo": false, 12 | "eqeqeq": false, 13 | "eqnull": true, 14 | "es3": true, 15 | "esnext": false, 16 | "evil": false, 17 | "expr": true, 18 | "forin": false, 19 | "funcscope": true, 20 | "gcl": false, 21 | "globalstrict": false, 22 | "immed": true, 23 | "iterator": false, 24 | "jquery": false, 25 | "lastsemic": false, 26 | "latedef": false, 27 | "laxbreak": true, 28 | "laxcomma": false, 29 | "loopfunc": true, 30 | "mootools": false, 31 | "moz": false, 32 | "multistr": false, 33 | "newcap": true, 34 | "noarg": true, 35 | "node": false, 36 | "noempty": false, 37 | "nonew": true, 38 | "nonstandard": false, 39 | "nomen": false, 40 | "onecase": false, 41 | "onevar": false, 42 | "passfail": false, 43 | "phantom": false, 44 | "plusplus": false, 45 | "proto": true, 46 | "prototypejs": false, 47 | "regexdash": true, 48 | "regexp": false, 49 | "rhino": false, 50 | "scripturl": true, 51 | "shadow": true, 52 | "shelljs": false, 53 | "smarttabs": true, 54 | "strict": false, 55 | "sub": false, 56 | "supernew": false, 57 | "trailing": true, 58 | "undef": true, 59 | "unused": true, 60 | "validthis": true, 61 | "withstmt": false, 62 | "worker": false, 63 | "wsh": false, 64 | "yui": false, 65 | "white": false, 66 | 67 | "maxlen": 140, 68 | "indent": 4, 69 | "maxerr": 250, 70 | "predef": [ "require", "define" ], 71 | "quotmark": "single", 72 | "maxcomplexity": 20 73 | } -------------------------------------------------------------------------------- /load-css.js: -------------------------------------------------------------------------------- 1 | define([], function(){ 2 | 'use strict'; 3 | // this module is responsible for doing the loading/insertion 4 | // of stylesheets to get CSS loaded. 5 | 6 | var cache = typeof _css_cache == 'undefined' ? {} : _css_cache; 7 | var doc = document; 8 | 9 | function has(){ 10 | return !doc.createStyleSheet; 11 | } 12 | var head = doc.head; 13 | function insertCss(css){ 14 | if(has("dom-create-style-element")){ 15 | // we can use standard