root / trunk / web / dojo / dojox / data / css.js @ 12
History | View | Annotate | Download (1.72 KB)
1 | 9 | andrej.cim | /*
|
---|---|---|---|
2 | Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
|
||
3 | Available via Academic Free License >= 2.1 OR the modified BSD license.
|
||
4 | see: http://dojotoolkit.org/license for details
|
||
5 | */
|
||
6 | |||
7 | |||
8 | if(!dojo._hasResource["dojox.data.css"]){ |
||
9 | dojo._hasResource["dojox.data.css"]=true; |
||
10 | dojo.provide("dojox.data.css");
|
||
11 | dojo.provide("dojox.data.css.rules");
|
||
12 | dojox.data.css.rules.forEach=function(fn,_1,_2){ |
||
13 | if(_2){
|
||
14 | var _3=function(_4){ |
||
15 | dojo.forEach(_4[_4.cssRules?"cssRules":"rules"],function(_5){ |
||
16 | if(!_5.type||_5.type!==3){ |
||
17 | var _6=""; |
||
18 | if(_4&&_4.href){
|
||
19 | _6=_4.href; |
||
20 | } |
||
21 | fn.call(_1?_1:this,_5,_4,_6);
|
||
22 | } |
||
23 | }); |
||
24 | }; |
||
25 | dojo.forEach(_2,_3); |
||
26 | } |
||
27 | }; |
||
28 | dojox.data.css.findStyleSheets=function(_7){ |
||
29 | var _8=[];
|
||
30 | var _9=function(_a){ |
||
31 | var s=dojox.data.css.findStyleSheet(_a);
|
||
32 | if(s){
|
||
33 | dojo.forEach(s,function(_b){
|
||
34 | if(dojo.indexOf(_8,_b)===-1){ |
||
35 | _8.push(_b); |
||
36 | } |
||
37 | }); |
||
38 | } |
||
39 | }; |
||
40 | dojo.forEach(_7,_9); |
||
41 | return _8;
|
||
42 | }; |
||
43 | dojox.data.css.findStyleSheet=function(_c){ |
||
44 | var _d=[];
|
||
45 | if(_c.charAt(0)==="."){ |
||
46 | _c=_c.substring(1);
|
||
47 | } |
||
48 | var _e=function(_f){ |
||
49 | if(_f.href&&_f.href.match(_c)){
|
||
50 | _d.push(_f); |
||
51 | return true; |
||
52 | } |
||
53 | if(_f.imports){
|
||
54 | return dojo.some(_f.imports,function(_10){ |
||
55 | return _e(_10);
|
||
56 | }); |
||
57 | } |
||
58 | return dojo.some(_f[_f.cssRules?"cssRules":"rules"],function(_11){ |
||
59 | if(_11.type&&_11.type===3&&_e(_11.styleSheet)){ |
||
60 | return true; |
||
61 | } |
||
62 | return false; |
||
63 | }); |
||
64 | }; |
||
65 | dojo.some(document.styleSheets,_e); |
||
66 | return _d;
|
||
67 | }; |
||
68 | dojox.data.css.determineContext=function(_12){ |
||
69 | var ret=[];
|
||
70 | if(_12&&_12.length>0){ |
||
71 | _12=dojox.data.css.findStyleSheets(_12); |
||
72 | }else{
|
||
73 | _12=document.styleSheets; |
||
74 | } |
||
75 | var _13=function(_14){ |
||
76 | ret.push(_14); |
||
77 | if(_14.imports){
|
||
78 | dojo.forEach(_14.imports,function(_15){
|
||
79 | _13(_15); |
||
80 | }); |
||
81 | } |
||
82 | dojo.forEach(_14[_14.cssRules?"cssRules":"rules"],function(_16){ |
||
83 | if(_16.type&&_16.type===3){ |
||
84 | _13(_16.styleSheet); |
||
85 | } |
||
86 | }); |
||
87 | }; |
||
88 | dojo.forEach(_12,_13); |
||
89 | return ret;
|
||
90 | }; |
||
91 | } |