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:
692 bytes
|
Rev | Line | |
---|
[d565449] | 1 | 'use strict';
|
---|
| 2 |
|
---|
| 3 | exports.addon = function (renderer) {
|
---|
| 4 | if (process.env.NODE_ENV !== 'production') {
|
---|
| 5 | require('./__dev__/warnOnMissingDependencies')('hydrate', renderer, ['put']);
|
---|
| 6 | }
|
---|
| 7 |
|
---|
| 8 | var hydrated = {};
|
---|
| 9 |
|
---|
| 10 | renderer.hydrate = function (sh) {
|
---|
| 11 | var cssRules = sh.cssRules || sh.sheet.cssRules;
|
---|
| 12 |
|
---|
| 13 | for (var i = 0; i < cssRules.length; i++)
|
---|
| 14 | hydrated[cssRules[i].selectorText] = 1;
|
---|
| 15 | };
|
---|
| 16 |
|
---|
| 17 | if (renderer.client) {
|
---|
| 18 | if (renderer.sh) renderer.hydrate(renderer.sh);
|
---|
| 19 |
|
---|
| 20 | var put = renderer.put;
|
---|
| 21 |
|
---|
| 22 | renderer.put = function (selector, css) {
|
---|
| 23 | if (selector in hydrated) return;
|
---|
| 24 |
|
---|
| 25 | put(selector, css);
|
---|
| 26 | };
|
---|
| 27 | }
|
---|
| 28 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.