See #525 for follow up.
--- /dev/null
+function hasInherit(property) {
+ for (var i = property.value.length - 1; i >= 0; i--) {
+ if (property.value[i][0] == 'inherit')
+ return true;
+ }
+
+ return false;
+}
+
+module.exports = hasInherit;
var compactable = require('./compactable');
var deepClone = require('./clone').deep;
var shallowClone = require('./clone').shallow;
+var hasInherit = require('./has-inherit');
var restoreShorthands = require('./restore-shorthands');
var stringifyProperty = require('../stringifier/one-time').property;
}
}
-function hasInherits(property) {
- for (var i = property.value.length - 1; i >= 0; i--) {
- if (property.value[i] == 'inherit')
- return true;
- }
-
- return false;
-}
-
function turnIntoMultiplex(property, size) {
property.multiplex = true;
if (left.unused || right.unused)
continue;
- if (hasInherits(right))
+ if (hasInherit(right))
continue;
if (!left.shorthand && right.shorthand && isComponentOf(right, left)) {
if (!compatibility.properties.merging && wouldBreakCompatibility(left, validator))
continue;
- if (component.value[0][0] != right.value[0][0] && (hasInherits(left) || hasInherits(right)))
+ if (component.value[0][0] != right.value[0][0] && (hasInherit(left) || hasInherit(right)))
continue;
if (wouldResultInLongerValue(left, right))
var compactable = require('./compactable');
var deepClone = require('./clone').deep;
+var hasInherit = require('./has-inherit');
var populateComponents = require('./populate-components');
var wrapSingle = require('./wrap-for-optimizing').single;
var component = candidateComponents[descriptor.components[i]];
var canOverride = compactable[component.name].canOverride;
+ if (hasInherit(component))
+ return;
+
if (!canOverride(newProperty.components[i], component, validator))
return;
]);
}
},
+ 'with inherit - pending #525': {
+ 'topic': 'a{padding-top:10px;padding-left:5px;padding-bottom:3px;padding-right:inherit}',
+ 'into': function (topic) {
+ assert.deepEqual(_optimize(topic), [
+ [['padding-top', false , false], ['10px']],
+ [['padding-left', false , false], ['5px']],
+ [['padding-bottom', false , false], ['3px']],
+ [['padding-right', false , false], ['inherit']]
+ ]);
+ }
+ },
'mixed importance': {
'topic': 'a{padding-top:10px;padding-left:5px;padding-bottom:3px;padding-right:2px!important}',
'into': function (topic) {