Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

fix for safari #1940

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/gridList/gridList.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ function GridListDirective($interpolate, $mdConstant, $mdGridLayout, $mdMedia) {
// The horizontal or vertical position of a tile, e.g., the 'top' or 'left' property value.
// The position comes the size of a 1x1 tile plus gutter for each previous tile in the
// row/column (offset).
var POSITION = $interpolate('calc( ( ({{unit}}) + {{gutter}} ) * {{offset}} ');
var POSITION = $interpolate('calc( ( {{unit}} + {{gutter}} ) * {{offset}} )');

// The actual size of a tile, e.g., width or height, taking rowSpan or colSpan into account.
// This is computed by multiplying the base unit by the rowSpan/colSpan, and then adding back
Expand Down
37 changes: 21 additions & 16 deletions src/core/services/theming/theming.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ function ThemableDirective($mdTheming) {
return $mdTheming;
}

function parseRules(theme, colorType, rules) {
function _parseRules(theme, colorType, rules) {
checkValidPalette(theme, colorType);

rules = rules.replace(/THEME_NAME/g, theme.name);
Expand Down Expand Up @@ -402,7 +402,11 @@ function parseRules(theme, colorType, rules) {
generatedRules.push(newRule);
});

return generatedRules.join('');
return generatedRules;
}

function parseRules(theme, colorType, rules) {
return _parseRules(theme, colorType, rules).join('');
}

// Generate our themes at run time given the state of THEMES and PALETTES
Expand Down Expand Up @@ -448,29 +452,30 @@ function generateThemes($injector) {
return rulesByType[DEFAULT_COLOR_TYPE] += rule;
});

var styleString = '';

// For each theme, use the color palettes specified for `primary`, `warn` and `accent`
// to generate CSS rules.
angular.forEach(THEMES, function(theme) {
THEME_COLOR_TYPES.forEach(function(colorType) {
styleString += parseRules(theme, colorType, rulesByType[colorType] + '');
});
// Insert our newly minted styles into the DOM
if (!generationIsDone) {
var head = document.getElementsByTagName('head')[0];
THEME_COLOR_TYPES.forEach(function(colorType) {
var styleString = _parseRules(theme, colorType, rulesByType[colorType]);
while(styleString.length) {
var style = document.createElement('style');
style.setAttribute('type', 'text/css');
style.appendChild(document.createTextNode(styleString.shift()));
head.appendChild(style);
}
});
generationIsDone = true;
}

if (theme.colors.primary.name == theme.colors.accent.name) {
console.warn("$mdThemingProvider: Using the same palette for primary and" +
" accent. This violates the material design spec.");
}
});

// Insert our newly minted styles into the DOM
if (!generationIsDone) {
var style = document.createElement('style');
style.innerHTML = styleString;
var head = document.getElementsByTagName('head')[0];
head.insertBefore(style, head.firstElementChild);
generationIsDone = true;
}

// The user specifies a 'default' contrast color as either light or dark,
// then explicitly lists which hues are the opposite contrast (eg. A100 has dark, A200 has light)
function sanitizePalette(palette) {
Expand Down