File tree Expand file tree Collapse file tree 6 files changed +170
-0
lines changed Expand file tree Collapse file tree 6 files changed +170
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ title : Ractive.getCSS()
3+ ---
4+ Returns scoped CSS from Ractive subclasses defined at the time of the call.
5+
6+ If used without arguments, it will return the scoped CSS of all subclasses.
7+
8+ ```js
9+ const Subclass1 = Ractive.extend({
10+ ...
11+ css: 'div{ color: red }'
12+ ...
13+ });
14+
15+ const Subclass2 = Ractive.extend({
16+ ...
17+ css: 'div{ color: green }'
18+ ...
19+ });
20+
21+ // css contains the scoped versions of div{ color: red } and div{ color: green }
22+ const css = Ractive.getCSS();
23+ ```
24+
25+ If provided an array of scoping IDs, it will return the scoped CSS of all subclasses whose scoping ID is included in the array.
26+
27+ ```js
28+ // Assuming the generated ID for this subclass is 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
29+ const Subclass1 = Ractive.extend({
30+ ...
31+ css: 'div{ color: red }'
32+ ...
33+ });
34+
35+ // Assuming the generated ID for this subclass is 'yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy'
36+ const Subclass2 = Ractive.extend({
37+ ...
38+ css: 'div{ color: green }'
39+ ...
40+ });
41+
42+ // css contains the scoped version of div{ color: red } only
43+ const css = Ractive.getCSS([ 'xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' ]);
44+
45+ ```
46+
47+ > ### ractive.getCSS()
48+ > Returns a `string` containing the scoped CSS of all subclasses.
49+ >
50+ > ### ractive.getCSS( scopingIds )
51+ > Returns a `string` containing the scoped CSS of all subclasses whose scoping ID is included in the array.
52+ >
53+ > > #### scopingIds *`Array`*
54+ > > An array of subclass CSS scoping ids.
Original file line number Diff line number Diff line change 1+ ---
2+ title : ractive.toCSS()
3+ ---
4+ Returns the scoped CSS of the current instance and its descendants.
5+
6+ ```js
7+ const Subclass = Ractive.extend({
8+ ...
9+ css: 'div{ color: red }'
10+ ...
11+ });
12+
13+ const subclassInstance = new Subclass({...});
14+
15+ // Contains the scoped version of div{ color: red }
16+ subclassInstance.toCSS();
17+ ```
18+
19+ At the moment, this will not work on a direct instance of Ractive and will log a warning. You can only use this method on an instance of a subclass.
20+
21+ ```js
22+ const ractiveInstance = new Ractive({...});
23+
24+ // This will log a warning.
25+ ractiveInstance.toCSS();
26+ ```
27+
28+ > ### ractive.toCSS()
29+ > Returns CSS *`String`*
Original file line number Diff line number Diff line change 1+ ---
2+ title : Ractive.getCSS()
3+ ---
4+ Returns scoped CSS from Ractive subclasses defined at the time of the call.
5+
6+ If used without arguments, it will return the scoped CSS of all subclasses.
7+
8+ ```js
9+ const Subclass1 = Ractive.extend({
10+ ...
11+ css: 'div{ color: red }'
12+ ...
13+ });
14+
15+ const Subclass2 = Ractive.extend({
16+ ...
17+ css: 'div{ color: green }'
18+ ...
19+ });
20+
21+ // css contains the scoped versions of div{ color: red } and div{ color: green }
22+ const css = Ractive.getCSS();
23+ ```
24+
25+ If provided an array of scoping IDs, it will return the scoped CSS of all subclasses whose scoping ID is included in the array.
26+
27+ ```js
28+ // Assuming the generated ID for this subclass is 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
29+ const Subclass1 = Ractive.extend({
30+ ...
31+ css: 'div{ color: red }'
32+ ...
33+ });
34+
35+ // Assuming the generated ID for this subclass is 'yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy'
36+ const Subclass2 = Ractive.extend({
37+ ...
38+ css: 'div{ color: green }'
39+ ...
40+ });
41+
42+ // css contains the scoped version of div{ color: red } only
43+ const css = Ractive.getCSS([ 'xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' ]);
44+
45+ ```
46+
47+ > ### ractive.getCSS()
48+ > Returns a `string` containing the scoped CSS of all subclasses.
49+ >
50+ > ### ractive.getCSS( scopingIds )
51+ > Returns a `string` containing the scoped CSS of all subclasses whose scoping ID is included in the array.
52+ >
53+ > > #### scopingIds *`Array`*
54+ > > An array of subclass CSS scoping ids.
Original file line number Diff line number Diff line change 1+ ---
2+ title : ractive.toCSS()
3+ ---
4+ Returns the scoped CSS of the current instance and its descendants.
5+
6+ ```js
7+ const Subclass = Ractive.extend({
8+ ...
9+ css: 'div{ color: red }'
10+ ...
11+ });
12+
13+ const subclassInstance = new Subclass({...});
14+
15+ // Contains the scoped version of div{ color: red }
16+ subclassInstance.toCSS();
17+ ```
18+
19+ At the moment, this will not work on a direct instance of Ractive and will log a warning. You can only use this method on an instance of a subclass.
20+
21+ ```js
22+ const ractiveInstance = new Ractive({...});
23+
24+ // This will log a warning.
25+ ractiveInstance.toCSS();
26+ ```
27+
28+ > ### ractive.toCSS()
29+ > Returns CSS *`String`*
Original file line number Diff line number Diff line change 104104 <li >{{{ createLink ' ractive.splice()' }}} </li >
105105 <li >{{{ createLink ' ractive.subtract()' }}} </li >
106106 <li >{{{ createLink ' ractive.teardown()' }}} </li >
107+ <li >{{{ createLink ' ractive.toCSS()' }}} </li >
107108 <li >{{{ createLink ' ractive.toggle()' }}} </li >
108109 <li >{{{ createLink ' ractive.toHTML()' }}} </li >
109110 <li >{{{ createLink ' ractive.transition()' }}} </li >
126127 <ul >
127128 <li >{{{ createLink ' Ractive.escapeKey()' }}} </li >
128129 <li >{{{ createLink ' Ractive.extend()' }}} </li >
130+ <li >{{{ createLink ' Ractive.getCSS()' }}} </li >
129131 <li >{{{ createLink ' Ractive.getNodeInfo()' }}} </li >
130132 <li >{{{ createLink ' Ractive.joinKeys()' }}} </li >
131133 <li >{{{ createLink ' Ractive.parse()' }}} </li >
Original file line number Diff line number Diff line change 104104 <li >{{{ createLink ' ractive.splice()' }}} </li >
105105 <li >{{{ createLink ' ractive.subtract()' }}} </li >
106106 <li >{{{ createLink ' ractive.teardown()' }}} </li >
107+ <li >{{{ createLink ' ractive.toCSS()' }}} </li >
107108 <li >{{{ createLink ' ractive.toggle()' }}} </li >
108109 <li >{{{ createLink ' ractive.toHTML()' }}} </li >
109110 <li >{{{ createLink ' ractive.transition()' }}} </li >
126127 <ul >
127128 <li >{{{ createLink ' Ractive.escapeKey()' }}} </li >
128129 <li >{{{ createLink ' Ractive.extend()' }}} </li >
130+ <li >{{{ createLink ' Ractive.getCSS()' }}} </li >
129131 <li >{{{ createLink ' Ractive.getNodeInfo()' }}} </li >
130132 <li >{{{ createLink ' Ractive.joinKeys()' }}} </li >
131133 <li >{{{ createLink ' Ractive.parse()' }}} </li >
You can’t perform that action at this time.
0 commit comments