// Tries to compact a prop in componentsSoFar
var compactSoFar = function (prop) {
var i;
+ var componentsCount = processable[prop].components.length;
// Check basics
if (!componentsSoFar[prop] || !componentsSoFar[prop].found)
// Find components for the shorthand
var components = [];
var realComponents = [];
- for (i = 0; i < processable[prop].components.length; i++) {
+ for (i = 0 ; i < componentsCount; i++) {
// Get property name
var pp = processable[prop].components[i];
return false;
}
- if (realComponents.length === processable[prop].components.length) {
+ if (realComponents.length === componentsCount) {
// When all the components are from real values, only allow shorthanding if their understandability allows it
// This is the case when every component can override their default values, or when all of them use the same function
var compactedLength = Token.getDetokenizedLength(compacted);
var authenticLength = Token.getDetokenizedLength(realComponents);
- if (realComponents.length === processable[prop].components.length || compactedLength < authenticLength || components.some(isHackValue)) {
+ if (realComponents.length === componentsCount || compactedLength < authenticLength || components.some(isHackValue)) {
compacted[0].isShorthand = true;
compacted[0].components = processable[prop].breakUp(compacted[0]);