main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
1.1 KB
|
Rev | Line | |
---|
[d565449] | 1 | 'use strict';
|
---|
| 2 |
|
---|
| 3 | exports.addon = function (renderer) {
|
---|
| 4 | renderer.selector = function (parentSelectors, selector) {
|
---|
| 5 | var parents = parentSelectors.split(',');
|
---|
| 6 | var result = [];
|
---|
| 7 | var selectors = selector.split(',');
|
---|
| 8 | var len1 = parents.length;
|
---|
| 9 | var len2 = selectors.length;
|
---|
| 10 | var i, j, sel, pos, parent, replacedSelector;
|
---|
| 11 |
|
---|
| 12 | for (i = 0; i < len2; i++) {
|
---|
| 13 | sel = selectors[i];
|
---|
| 14 | pos = sel.indexOf('&');
|
---|
| 15 |
|
---|
| 16 | if (pos > -1) {
|
---|
| 17 | for (j = 0; j < len1; j++) {
|
---|
| 18 | parent = parents[j];
|
---|
| 19 | replacedSelector = sel.replace(/&/g, parent);
|
---|
| 20 | result.push(replacedSelector);
|
---|
| 21 | }
|
---|
| 22 | } else {
|
---|
| 23 | for (j = 0; j < len1; j++) {
|
---|
| 24 | parent = parents[j];
|
---|
| 25 |
|
---|
| 26 | if (parent) {
|
---|
| 27 | result.push(parent + ' ' + sel);
|
---|
| 28 | } else {
|
---|
| 29 | result.push(sel);
|
---|
| 30 | }
|
---|
| 31 | }
|
---|
| 32 | }
|
---|
| 33 | }
|
---|
| 34 |
|
---|
| 35 | return result.join(',');
|
---|
| 36 | };
|
---|
| 37 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.