Skip to content
This repository has been archived by the owner on Aug 19, 2022. It is now read-only.

Commit

Permalink
Fix prefix on server with css style
Browse files Browse the repository at this point in the history
  • Loading branch information
ianobermiller committed May 15, 2015
1 parent bcdf04d commit a8e6b13
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
19 changes: 9 additions & 10 deletions modules/prefix.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var jsCssMap = {
};
var testProp = 'Transform';

var domStyle;
var domStyle = {};
var prefixedPropertyCache = {};
var prefixedValueCache = {};
var jsVendorPrefix = '';
Expand All @@ -26,10 +26,10 @@ var cssVendorPrefix = '';
if (ExecutionEnvironment.canUseDOM) {
domStyle = document.createElement('p').style;

for (var js in jsCssMap) {
if ((js + testProp) in domStyle) {
jsVendorPrefix = js;
cssVendorPrefix = jsCssMap[js];
for (var jsPrefix in jsCssMap) {
if ((jsPrefix + testProp) in domStyle) {
jsVendorPrefix = jsPrefix;
cssVendorPrefix = jsCssMap[jsPrefix];
break;
}
}
Expand All @@ -40,7 +40,10 @@ var _getPrefixedProperty = function (property) {
return prefixedPropertyCache[property];
}

if (property in domStyle) {
if (
!ExecutionEnvironment.canUseDOM ||
property in domStyle
) {
// unprefixed
prefixedPropertyCache[property] = {
css: kebabCase(property),
Expand Down Expand Up @@ -109,10 +112,6 @@ var _getPrefixedValue = function (property, value) {
// and values.
/*eslint-disable no-console */
var prefix = function (style, mode /* 'css' or 'js' */) {
if (!ExecutionEnvironment.canUseDOM) {
return style;
}

mode = mode || 'js';
var newStyle = {};
Object.keys(style).forEach(function (property) {
Expand Down
6 changes: 5 additions & 1 deletion modules/resolve-styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ var _onMediaQueryChange = function (component, query, mediaQueryList) {
};

var _resolveMediaQueryStyles = function (component, style) {
if (!ExecutionEnvironment.canUseDOM) {
if (
!ExecutionEnvironment.canUseDOM ||
!window ||
!window.matchMedia
) {
return style;
}

Expand Down

0 comments on commit a8e6b13

Please sign in to comment.