From: Jakub Pawlowicz Date: Mon, 5 Jan 2015 23:20:27 +0000 (+0000) Subject: Adds smart selector restructuring. X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=9aa4f49069208950c3090f4c52d2bb2705094a88;p=clean-css.git Adds smart selector restructuring. The algorithm traverses tokens list backwards, picking up any properties on its way. If a property already exists and has the same value, it adds the current token to the list of matching that property, otherwise one of two things happens: * The property is dropped from the list if there's been only one token associated with it. * It tries to move properties around if it results in a shorter content. --- diff --git a/lib/selectors/optimizers/advanced.js b/lib/selectors/optimizers/advanced.js index d738f6bb..b6d2cf7f 100644 --- a/lib/selectors/optimizers/advanced.js +++ b/lib/selectors/optimizers/advanced.js @@ -23,12 +23,19 @@ function unsafeSelector(value) { return /\.|\*| :/.test(value); } +function naturalSorter(a, b) { + return a > b; +} + function allProperties(token) { var properties = []; if (token.kind == 'selector') { for (var i = token.metadata.bodiesList.length - 1; i >= 0; i--) { var property = token.metadata.bodiesList[i]; + if (property.indexOf('__ESCAPED') === 0) + continue; + var splitAt = property.indexOf(':'); var name = property.substring(0, splitAt); var nameRoot = name.match(/([a-z]+)/)[0]; @@ -51,27 +58,32 @@ function allProperties(token) { function canReorder(left, right) { for (var i = right.length - 1; i >= 0; i--) { for (var j = left.length - 1; j >= 0; j--) { - var rightName = right[i][0]; - var rightValue = right[i][1]; - var rightNameRoot = right[i][2]; - var leftName = left[j][0]; - var leftValue = left[j][1]; - var leftNameRoot = left[j][2]; - - if (rightNameRoot != leftNameRoot) - continue; - if (rightName == leftName && rightNameRoot == leftNameRoot && rightValue == leftValue) - continue; - if (rightName != leftName && rightNameRoot == leftNameRoot && rightName != rightNameRoot && leftName != leftNameRoot) - continue; - - return false; + if (!canReorderSingle(right[i], left[j])) + return false; } } return true; } +function canReorderSingle(right, left) { + var rightName = right[0]; + var rightValue = right[1]; + var rightNameRoot = right[2]; + var leftName = left[0]; + var leftValue = left[1]; + var leftNameRoot = left[2]; + + if (rightNameRoot != leftNameRoot) + return true; + if (rightName == leftName && rightNameRoot == leftNameRoot && rightValue == leftValue) + return true; + if (rightName != leftName && rightNameRoot == leftNameRoot && rightName != rightNameRoot && leftName != leftNameRoot) + return true; + + return false; +} + AdvancedOptimizer.prototype.isSpecial = function (selector) { return this.options.compatibility.selectors.special.test(selector); }; @@ -351,7 +363,7 @@ AdvancedOptimizer.prototype.mergeNonAdjacentBySelector = function (tokens) { var joinAt = [movedToken.body.length]; var newBody = this.propertyOptimizer.process(targetToken.value, targetToken.body.concat(movedToken.body), joinAt, true); changeBodyOf(targetToken, newBody); - movedToken.body = []; + changeBodyOf(movedToken, { tokenized: [], list: [] }); } } }; @@ -375,7 +387,7 @@ AdvancedOptimizer.prototype.mergeNonAdjacentByBody = function (tokens) { CleanUp.selectors(oldToken.value.concat(token.value), false, adjacentSpace) ); - oldToken.body = []; + changeBodyOf(oldToken, { tokenized: [], list: [] }); candidates[token.metadata.body] = null; } @@ -383,6 +395,157 @@ AdvancedOptimizer.prototype.mergeNonAdjacentByBody = function (tokens) { } }; +AdvancedOptimizer.prototype.restructure = function (tokens) { + var movableTokens = {}; + var movedProperties = []; + var adjacentSpace = this.options.compatibility.selectors.adjacentSpace; + var self = this; + + function tokensToMerge(sourceTokens) { + var uniqueTokens = []; + var mergeableTokens = []; + + for (var i = sourceTokens.length - 1; i >= 0; i--) { + if (self.isSpecial(sourceTokens[i].metadata.selector)) + continue; + + mergeableTokens.unshift(sourceTokens[i]); + if (uniqueTokens.indexOf(sourceTokens[i]) == -1) + uniqueTokens.push(sourceTokens[i]); + } + + return uniqueTokens.length > 1 ? + mergeableTokens : + []; + } + + function shouldResultInAShorterContent(movedProperty, asNewTokenCallback) { + var name = movedProperty[0]; + var value = movedProperty[1]; + var valueSize = name.length + value.length + 2; + var beforeSize = 0; + var afterSize = 0; + var allSelectors = []; + var mergeableTokens = tokensToMerge(movableTokens[name]); + + for (var i = mergeableTokens.length - 1; i >= 0; i--) { + var mergeableToken = mergeableTokens[i]; + allSelectors = mergeableToken.value.concat(allSelectors); + + var selectorLength = mergeableToken.metadata.selector.length + mergeableToken.metadata.body.length; + if (mergeableToken.body.length > 1) + afterSize += selectorLength - valueSize - 1; + beforeSize += selectorLength; + } + + allSelectors = CleanUp.selectors(allSelectors, false, adjacentSpace); + afterSize += allSelectors.list.join(',').length + valueSize; + + if (afterSize < beforeSize) + asNewTokenCallback(name, value, allSelectors, mergeableTokens); + } + + function dropAsNewTokenAt(position) { + return function (name, value, allSelectors, mergeableTokens) { + var bodyMetadata; + + for (var i = mergeableTokens.length - 1; i >= 0; i--) { + var mergeableToken = mergeableTokens[i]; + + for (var j = mergeableToken.body.length - 1; j >= 0; j--) { + if (mergeableToken.body[j].value.indexOf(name + ':') === 0) { + bodyMetadata = mergeableToken.body[j].metadata; + + mergeableToken.body.splice(j, 1); + mergeableToken.metadata.bodiesList.splice(j, 1); + mergeableToken.metadata.body = mergeableToken.metadata.bodiesList.join(';'); + break; + } + } + } + + var newToken = { kind: 'selector', metadata: {} }; + changeSelectorOf(newToken, allSelectors); + changeBodyOf(newToken, { + tokenized: [{ value: name + ':' + value }], + list: [name + ':' + value] + }); + if (self.options.sourceMap) + newToken.body[0].metadata = bodyMetadata; + + tokens.splice(position, 0, newToken); + }; + } + + function dropPropertiesAt(position, movedProperty) { + var movedName = movedProperty[0]; + + if (movableTokens[movedName] && movableTokens[movedName].length > 1) + shouldResultInAShorterContent(movedProperty, dropAsNewTokenAt(position)); + } + + for (var i = tokens.length - 1; i >= 0; i--) { + var token = tokens[i]; + var isSelector; + + if (token.kind == 'selector') { + isSelector = true; + } else if (token.kind == 'block' && !token.isFlatBlock) { + isSelector = false; + } else { + continue; + } + + var properties = allProperties(token); + var movedToBeDropped = []; + + // We cache movedProperties.length as it may change in the loop + var movedCount = movedProperties.length; + + for (var j = 0, m = properties.length; j < m; j++) { + var property = properties[j]; + var canReorder = true; + var movedSameProperty = false; + + for (var k = 0; k < movedCount; k++) { + var movedProperty = movedProperties[k]; + + if (movedToBeDropped.indexOf(k) == -1 && !canReorderSingle(property, movedProperty)) { + dropPropertiesAt(i + 1, movedProperty); + movedToBeDropped.push(k); + canReorder = false; + } + + if (!movedSameProperty) + movedSameProperty = property[0] == movedProperty[0] && property[1] == movedProperty[1]; + } + + if (!isSelector) + continue; + + if (canReorder) { + var name = property[0]; + movableTokens[name] = movableTokens[name] || []; + movableTokens[name].push(token); + } + + if (!movedSameProperty) + movedProperties.push(property); + } + + movedToBeDropped = movedToBeDropped.sort(naturalSorter); + for (j = 0, m = movedToBeDropped.length; j < m; j++) { + delete movableTokens[movedProperties[movedToBeDropped[j] - j][0]]; + movedProperties.splice(movedToBeDropped[j] - j, 1); + } + } + + var position = tokens[0] && tokens[0].kind == 'at-rule' && tokens[0].value.indexOf('@charset') === 0 ? 1 : 0; + for (i = 0; i < movedProperties.length; i++) { + dropPropertiesAt(position, movedProperties[i]); + } +}; + AdvancedOptimizer.prototype.mergeMediaQueries = function (tokens) { var candidates = {}; var reduced = []; @@ -464,6 +627,9 @@ AdvancedOptimizer.prototype.optimize = function (tokens) { self.mergeNonAdjacentBySelector(tokens); self.mergeNonAdjacentByBody(tokens); + self.restructure(tokens); + self.mergeAdjacent(tokens); + if (self.options.mediaMerging) { var reduced = self.mergeMediaQueries(tokens); for (var i = reduced.length - 1; i >= 0; i--) { diff --git a/test/fixtures/960-min.css b/test/fixtures/960-min.css old mode 100755 new mode 100644 index 4e854ab9..85cf2289 --- a/test/fixtures/960-min.css +++ b/test/fixtures/960-min.css @@ -1,3 +1,4 @@ +.clear,.clearfix:after{clear:both} .container_24{margin-right:auto;margin-left:auto;width:960px} .grid_1,.grid_10,.grid_11,.grid_12,.grid_13,.grid_14,.grid_15,.grid_16,.grid_17,.grid_18,.grid_19,.grid_2,.grid_20,.grid_21,.grid_22,.grid_23,.grid_24,.grid_3,.grid_4,.grid_5,.grid_6,.grid_7,.grid_8,.grid_9{display:inline;float:right;margin-right:5px;margin-left:5px} .pull_1,.pull_10,.pull_11,.pull_12,.pull_13,.pull_14,.pull_15,.pull_16,.pull_17,.pull_18,.pull_19,.pull_2,.pull_20,.pull_21,.pull_22,.pull_23,.pull_3,.pull_4,.pull_5,.pull_6,.pull_7,.pull_8,.pull_9,.push_1,.push_10,.push_11,.push_12,.push_13,.push_14,.push_15,.push_16,.push_17,.push_18,.push_19,.push_2,.push_20,.push_21,.push_22,.push_23,.push_3,.push_4,.push_5,.push_6,.push_7,.push_8,.push_9{position:relative} @@ -119,7 +120,6 @@ .container_24 .pull_21{right:-840px} .container_24 .pull_22{right:-880px} .container_24 .pull_23{right:-920px} -.clear{clear:both;display:block;overflow:hidden;visibility:hidden;width:0;height:0} +.clear{display:block;overflow:hidden;visibility:hidden;width:0;height:0} .clearfix:after,.clearfix:before{content:'\0020';display:block;overflow:hidden;visibility:hidden;width:0;height:0} -.clearfix:after{clear:both} .clearfix{zoom:1} \ No newline at end of file diff --git a/test/fixtures/big-min.css b/test/fixtures/big-min.css index 5023e4f8..96e94470 100644 --- a/test/fixtures/big-min.css +++ b/test/fixtures/big-min.css @@ -1,7 +1,9 @@ +.bt_fonce a,.btn,.btn_abo,.btn_fonce,.btn_petit{filter:progid:dximagetransform.microsoft.gradient(enabled=false)} /*! normalize.css 2012-01-31T16:06 UTC - http://github.com/necolas/normalize.css */ article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display:block} audio,canvas,video{display:inline-block} [hidden],audio:not([controls]){display:none} +.tt15_capital,.tt17,.tt17_capital,.tt20,.tt24,.tt28,.tt32,.tt40{display:block} html{-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%} button,html,input,select,textarea{font-family:sans-serif} body,figure,form{margin:0} @@ -11,6 +13,7 @@ h1,h2,h3,h4,h5,h6{margin:0;font-weight:700} p{-webkit-margin-before:0;-webkit-margin-after:0} abbr[title]{border-bottom:1px dotted} b,strong{font-weight:700} +.tt15_capital,.tt17,.tt17_capital,.tt20,.tt24,.tt26_capital,.tt28,.tt32,.tt40{font-weight:400} blockquote{margin:1em 40px} dfn{font-style:italic} mark{background:#ff0;color:#000} @@ -31,6 +34,7 @@ fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em} legend{border:0;padding:0;white-space:normal} button,input,select,textarea{font-size:100%;margin:0;vertical-align:baseline} button,input{line-height:normal} +.tt32,.tt40{line-height:105%} button,input[type=button],input[type=reset],input[type=submit]{cursor:pointer;-webkit-appearance:button} button[disabled],input[disabled]{cursor:default} input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0} @@ -42,24 +46,28 @@ table{border-spacing:0} @font-face{font-family:TheSerifOffice;src:url(/medias/web/font/svg/TheSerifOffice-OT7_West.svgz#TheSerifOffice)format('svg');src:url(/medias/web/font/eot/TheSerifOffice-TT7_.eot);src:url(/medias/web/font/eot/TheSerifOffice-TT7_.eot?#iefix)format('embedded-opentype'),url(/medias/web/font/woff/TheSerifOffice-TT7_.woff)format('woff');font-weight:400;font-style:normal} @font-face{font-family:FetteEngschrift;src:url(/medias/web/font/eot/fetteengschrift.eot);src:url(/medias/web/font/eot/fetteengschrift.eot?#iefix)format('embedded-opentype'),url(/medias/web/font/woff/fetteengschrift.woff)format('woff');font-weight:400;font-style:normal} .global .bloc_bandeau .bandeau,.global .bloc_droit .bandeau{font-family:FetteEngschrift,'Arial Narrow',sans-serif} -.tt40{display:block;font-size:4rem;line-height:105%;font-family:TheSerifOffice,georgia,serif;font-weight:400;margin:0 0 .5rem} +.tt32,.tt40{font-family:TheSerifOffice,georgia,serif} +.tt40{font-size:4rem;margin:0 0 .5rem} .ie .tt40{font-size:40px;margin:0 0 .5px} -.tt32{display:block;font-size:3.2rem;line-height:105%;font-family:TheSerifOffice,georgia,serif;font-weight:400} +.tt32{font-size:3.2rem} .ie .tt32{font-size:32px;margin:0 0 10px} -.tt28{display:block;font-size:2.8rem;line-height:105%;font-family:TheSerifOffice,georgia,serif;font-weight:400;margin:0 0 1rem} +.tt28{font-size:2.8rem;line-height:105%;font-family:TheSerifOffice,georgia,serif;margin:0 0 1rem} .ie .tt28{font-size:28px;margin:0 0 10px} -.tt26_capital{font-size:2.6rem;line-height:120%;font-family:FetteEngschrift,'Arial Narrow',sans-serif;font-weight:400;margin:0 0 .4rem;text-transform:uppercase} +.tt26_capital{font-size:2.6rem;line-height:120%;font-family:FetteEngschrift,'Arial Narrow',sans-serif;margin:0 0 .4rem;text-transform:uppercase} +.tt20,.tt24{font-family:TheSerifOffice,georgia,serif} .ie .tt26_capital{font-size:26px;margin:0 0 4px} -.tt24{display:block;font-size:2.4rem;line-height:105%;font-family:TheSerifOffice,georgia,serif;font-weight:400;margin:0 0 .3rem} +.tt24{font-size:2.4rem;line-height:105%;margin:0 0 .3rem} .ie .tt24{font-size:24px;margin:0 0 3px} -.tt20{display:block;font-size:2rem;line-height:105%;font-family:TheSerifOffice,georgia,serif;font-weight:400;padding:0 0 .3rem} +.tt20{font-size:2rem;line-height:105%;padding:0 0 .3rem} .ie .tt20{font-size:20px;padding:0 0 3px} -.tt17,.tt17_capital{display:block;font-size:1.7rem;line-height:120%;font-family:TheSerifOffice,georgia,serif;font-weight:400;margin:0 0 .4rem} -.tt17_capital{font-family:FetteEngschrift,'Arial Narrow',sans-serif;text-transform:uppercase;margin:0 0 4px} +.tt17,.tt17_capital{font-size:1.7rem;line-height:120%;font-family:TheSerifOffice,georgia,serif;margin:0 0 .4rem} +.tt15_capital,.tt17_capital{font-family:FetteEngschrift,'Arial Narrow',sans-serif} +.tt17_capital{text-transform:uppercase;margin:0 0 4px} .ie .tt17,.ie .tt17_capital{font-size:17px} -.tt15_capital{display:block;font-size:1.5rem;line-height:120%;font-family:FetteEngschrift,'Arial Narrow',sans-serif;font-weight:400;text-transform:uppercase} +.tt15_capital{font-size:1.5rem;line-height:120%;text-transform:uppercase} .ie .tt15_capital{font-size:15px;margin:0 0 4px} .tt13_capital{display:block;font-size:1.3rem;line-height:120%;font-family:FetteEngschrift,'Arial Narrow',sans-serif;font-weight:400;margin:0 0 .4rem;text-transform:uppercase} +.txt10,.txt11,.txt12,.txt13_120,.txt13_140,.txt14_120,.txt14_140,.txt15_120,body{font-family:arial,sans-serif} .ie .tt13_capital{font-size:13px;margin:0 0 4px} .txt18{font-size:1.8rem;line-height:105%} .ie .txt18{font-size:18px} @@ -70,14 +78,13 @@ table{border-spacing:0} .txt14_120{line-height:120%} .ie .txt14_120,.ie .txt14_140{font-size:14px} .txt13_120,.txt13_140{font-size:1.3rem;line-height:140%} -.txt13_120{line-height:120%} +.txt11,.txt12,.txt13_120{line-height:120%} .ie .txt13_120,.ie .txt13_140{font-size:13px} -.txt12{line-height:120%;font-size:1.2rem} -.txt11{line-height:120%;font-size:1.1rem} +.txt12{font-size:1.2rem} +.txt11{font-size:1.1rem} .ie .txt11{font-size:11px} .txt10{line-height:120%;font-size:1rem} .ie .txt10{font-size:10px} -.txt10,.txt11,.txt12,.txt13_120,.txt13_140,.txt14_120,.txt14_140,.txt15_120{font-family:arial,sans-serif} .container_18{margin:0 13px;width:974px} .grid_1,.grid_10,.grid_11,.grid_12,.grid_13,.grid_14,.grid_15,.grid_16,.grid_17,.grid_18,.grid_2,.grid_3,.grid_4,.grid_5,.grid_6,.grid_7,.grid_8,.grid_9{box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;display:inline;float:left;position:relative;margin-left:8px;margin-right:8px} .alpha{margin-left:0;clear:left} @@ -173,7 +180,7 @@ table{border-spacing:0} * html .clearfix{height:1%} .clearfix{display:block} html{font-size:62.5%} -body{font-size:1.3rem;font-size:13px;line-height:140%;font-family:arial,sans-serif;color:#16212c;background:#e9edf0} +body{font-size:1.3rem;font-size:13px;line-height:140%;color:#16212c;background:#e9edf0} .global{width:1000px;margin:0 auto;padding:20px 0 10px;background:#fff} .lmd-header{position:relative;z-index:15} .lmd-footer #bandeau_bas{display:none} @@ -248,8 +255,8 @@ section article{margin:0 0 16px} .bloc_abo{border-top:3px solid #ffd500} img[width="642"],img[width="312"]{margin-bottom:6px} img[width="202"]{margin-bottom:4px} -.btn,.btn_abo,.btn_fonce,.btn_petit{display:inline-block;padding:4px 10px;margin-bottom:0;color:#000b15;text-align:center;font-weight:700;vertical-align:middle;background-color:#f5f5f5;background-image:-moz-linear-gradient(top,#fff,#e6e6e6);background-image:-ms-linear-gradient(top,#fff,#e6e6e6);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#e6e6e6));background-image:-webkit-linear-gradient(top,#fff,#e6e6e6);background-image:-o-linear-gradient(top,#fff,#e6e6e6);background-image:linear-gradient(top,#fff,#e6e6e6);background-repeat:repeat-x;filter:progid:dximagetransform.microsoft.gradient(enabled=false);border:1px solid #ccc;border-bottom-color:#b3b3b3;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);cursor:pointer} -.bt_fonce a,.btn_fonce{color:#fff;background-color:#000b15;background-image:-moz-linear-gradient(top,#5d666d,#000b15);background-image:-ms-linear-gradient(top,#5d666d,#000b15);background-image:-webkit-gradient(linear,0 0,0 100%,from(#5d666d),to(#000b15));background-image:-webkit-linear-gradient(top,#5d666d,#000b15);background-image:-o-linear-gradient(top,#5d666d,#000b15);background-image:linear-gradient(top,#5d666d,#000b15);background-repeat:repeat-x;border-color:#000b15;border-color:rgba(0,0,0,.1);filter:progid:dximagetransform.microsoft.gradient(enabled=false)} +.btn,.btn_abo,.btn_fonce,.btn_petit{display:inline-block;padding:4px 10px;margin-bottom:0;color:#000b15;text-align:center;font-weight:700;vertical-align:middle;background-color:#f5f5f5;background-image:-moz-linear-gradient(top,#fff,#e6e6e6);background-image:-ms-linear-gradient(top,#fff,#e6e6e6);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#e6e6e6));background-image:-webkit-linear-gradient(top,#fff,#e6e6e6);background-image:-o-linear-gradient(top,#fff,#e6e6e6);background-image:linear-gradient(top,#fff,#e6e6e6);background-repeat:repeat-x;border:1px solid #ccc;border-bottom-color:#b3b3b3;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);cursor:pointer} +.bt_fonce a,.btn_fonce{color:#fff;background-color:#000b15;background-image:-moz-linear-gradient(top,#5d666d,#000b15);background-image:-ms-linear-gradient(top,#5d666d,#000b15);background-image:-webkit-gradient(linear,0 0,0 100%,from(#5d666d),to(#000b15));background-image:-webkit-linear-gradient(top,#5d666d,#000b15);background-image:-o-linear-gradient(top,#5d666d,#000b15);background-image:linear-gradient(top,#5d666d,#000b15);background-repeat:repeat-x;border-color:#000b15;border-color:rgba(0,0,0,.1)} .btn_abo{color:#000b15;background-color:#ffc600;background-image:-moz-linear-gradient(top,#ffe562,#ffc600);background-image:-ms-linear-gradient(top,#ffe562,#ffc600);background-image:-webkit-gradient(linear,0 0,0 100%,from(#ffe562),to(#ffc600));background-image:-webkit-linear-gradient(top,#ffe562,#ffc600);background-image:-o-linear-gradient(top,#ffe562,#ffc600);background-image:linear-gradient(top,#ffe562,#ffc600);background-repeat:repeat-x;border-color:#ffc600;border-color:rgba(0,0,0,.1);filter:progid:dximagetransform.microsoft.gradient(enabled=false)} .btn.large{width:100%;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box} .btn_petit{padding:2px 4px;font-size:11px;line-height:16px} @@ -266,11 +273,12 @@ img[width="202"]{margin-bottom:4px} .btn_abo:active{background-color:#ffc600} input.btn,input.btn_abo,input.btn_fonce,input.btn_petit{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box} button::-moz-focus-inner,input[type=submit]::-moz-focus-inner{padding:0;border:0} +.az,.titre_bt_fleche .bt{border-left:1px solid #e4e6e9} .bt_abo{display:inline-block;padding:3px 12px;background:#ffd500;font-weight:700;color:#650} .bt_abo:hover{background:#ffc600;color:#000;font-weight:700;cursor:pointer;text-decoration:none} .titre_bt_fleche{display:inline-block;overflow:hidden;background:#f5f8f9} .titre_bt_fleche:hover{background:#e9edf0} -.titre_bt_fleche .bt{position:relative;display:block;float:right;width:42px;border-left:1px solid #e4e6e9;background-color:#e9edf0;min-height:64px} +.titre_bt_fleche .bt{position:relative;display:block;float:right;width:42px;background-color:#e9edf0;min-height:64px} .titre_bt_fleche .fleche{position:absolute;right:13px;top:33%;background:url(/medias/web/img/sprites/icos_petites.png)-1px -108px no-repeat;width:13px;height:22px} .titre_bt_fleche:hover .fleche{background-position:-15px -108px} .titre_bt_fleche .titre,.titre_bt_fleche img{float:left} @@ -312,7 +320,7 @@ button::-moz-focus-inner,input[type=submit]::-moz-focus-inner{padding:0;border:0 .nb_commentaires .pic,.nb_reactions .pic{vertical-align:text-bottom;margin:0 3px 0 0;width:12px;height:11px;background-position:-13px 0} .lien_externe{color:#5d666d;font-size:11px} .lien_externe span{width:13px;height:10px;margin:0 3px 0 5px;background-position:0 -131px} -.az{float:right;padding:10px 3px 10px 10px;width:28px;height:15px;border-left:1px solid #e4e6e9;font-size:12px;line-height:12px;font-weight:700} +.az{float:right;padding:10px 3px 10px 10px;width:28px;height:15px;font-size:12px;line-height:12px;font-weight:700} .az:hover{background:#a2a9ae;cursor:pointer} .bt_fermer,.bt_fermer:hover,.bt_ouvrir,.bt_ouvrir:hover{width:16px;height:14px} .bt_ouvrir{background-position:0 -158px} @@ -562,14 +570,15 @@ img[height="97"]+.ico29x29{bottom:6%;left:3.5%} .conteneur_onglets .onglet.desactive>span{cursor:default;color:#b8c0c3} .conteneur_onglets .onglet.courant>a{font-weight:700;color:#2e3942;cursor:default} .lien_img314x64{display:block;width:314px;height:64px;margin-bottom:16px} +.abonne_cartouche44x12,.ea109x13,.ea_article,.huffington148x10,.logo_lm95x16,.logo_lm_abo95x16,.telerama47x18{display:inline-block} .lien_img314x64:hover{opacity:.7;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=70)"} -.abonne_cartouche44x12{display:inline-block;width:44px;height:12px;margin:0 0 0 5px;background:url(/medias/web/img/elements_lm/abonne_cartouche44x12.png);text-indent:-9999px;font-size:13px;vertical-align:middle} -.ea109x13{display:inline-block;width:109px;height:13px;background:url(/medias/web/img/elements_lm/edition_abonnes109x13.png);text-indent:-9999px;font-size:13px;vertical-align:baseline} -.logo_lm95x16,.logo_lm_abo95x16{display:inline-block;width:95px;height:16px;background:url(/medias/web/img/elements_lm/logo_lm95x16.png);text-indent:-9999px;font-size:13px;vertical-align:baseline} +.abonne_cartouche44x12{width:44px;height:12px;margin:0 0 0 5px;background:url(/medias/web/img/elements_lm/abonne_cartouche44x12.png);text-indent:-9999px;font-size:13px;vertical-align:middle} +.ea109x13{width:109px;height:13px;background:url(/medias/web/img/elements_lm/edition_abonnes109x13.png);text-indent:-9999px;font-size:13px;vertical-align:baseline} +.logo_lm95x16,.logo_lm_abo95x16{width:95px;height:16px;background:url(/medias/web/img/elements_lm/logo_lm95x16.png);text-indent:-9999px;font-size:13px;vertical-align:baseline} .logo_lm95x16{background:url(/medias/web/img/elements_lm/logo_lm95x16.png)0 -16px} -.ea_article{position:absolute;left:-18px;top:3px;display:inline-block;width:55px;height:59px;text-indent:-9999px;background:url(/medias/web/img/elements_lm/marqueur_ea_article.png)} -.huffington148x10{display:inline-block;width:148px;height:10px;text-indent:-9999px;background:url(/medias/web/img/groupe/logo_huffington149x10.png)} -.telerama47x18{display:inline-block;width:47px;height:18px;text-indent:-9999px;background:url(/medias/web/img/groupe/logo_teleramafr47x18.png)} +.ea_article{position:absolute;left:-18px;top:3px;width:55px;height:59px;text-indent:-9999px;background:url(/medias/web/img/elements_lm/marqueur_ea_article.png)} +.huffington148x10{width:148px;height:10px;text-indent:-9999px;background:url(/medias/web/img/groupe/logo_huffington149x10.png)} +.telerama47x18{width:47px;height:18px;text-indent:-9999px;background:url(/medias/web/img/groupe/logo_teleramafr47x18.png)} .courrier72x21{display:inline-block;width:72px;height:21px;text-indent:-9999px;background:url(/medias/web/img/groupe/logo_courrier72x21.png)} .lien_img314x64.festival_cannes_une{background:url(/medias/web/img/evenementiel/festival_de_cannes_2012/widget_une.png);text-indent:-9999px} .lien_img314x64.legislatives_2012_une{background:url(/medias/web/img/evenementiel/legislatives_2012/widget_une.png);text-indent:-9999px} @@ -681,23 +690,22 @@ img[height="97"]+.ico29x29{bottom:6%;left:3.5%} #footer{width:1000px;margin:0 auto 50px;font-size:11px;text-align:left} .ie #footer{font-size:11px} #footer .obf:hover,#footer a:hover{text-decoration:underline} +#footer .deja_abonne .obf:hover,#footer .footer_bas .nl:hover,#footer .zone_abo:hover{text-decoration:none} #footer .footer_gratuit{overflow:hidden} #footer .abonnement{float:left;width:673px;height:155px;background:url(/medias/web/img/elements_lm/footer_supports.jpg)right bottom no-repeat} #footer .zone_abo{display:block;float:left;width:673px;height:155px;background:url(/medias/web/img/elements_lm/footer_supports_haut.png)385px top no-repeat} -#footer .zone_abo:hover{text-decoration:none} #footer .abonnement .contenu{margin:35px 0 0;padding:30px 346px 0 13px;background:url(/medias/web/img/elements_lm/le_monde_abonements_227x22.png)13px top no-repeat;color:#16212c;line-height:120%} #footer .abonnement .bt{padding:5px 0 0 13px} #footer .deja_abonne{float:left;width:183px;height:110px;padding:10px 125px 10px 16px;margin:25px 0 0;background:url(/medias/web/img/elements_lm/footer_deja_abo.jpg)right top no-repeat #fafbfc} #footer .deja_abonne .accroche{display:block;font-weight:700;font-size:17px;padding:0 0 8px} #footer .deja_abonne .obf,#footer .deja_abonne .trigger_boite_login{display:block;padding:0 0 0 10px;position:relative} #footer .deja_abonne .obf:before,#footer .deja_abonne .trigger_boite_login:before{color:#5d666d;content:'\203A';display:block;float:left;font-size:1.2rem;left:0;position:absolute;width:10px} -#footer .deja_abonne .obf:hover{text-decoration:none} #footer .footer_listes{overflow:hidden;padding:0 13px;background:#16212c;color:#2e3942;line-height:120%} #footer .footer_listes div{float:left;width:152px;padding:10px 16px 10px 0} #footer .footer_listes div:nth-child(2n+2){width:303px} #footer .footer_listes .titre{display:block;margin:0 0 4px;font-weight:700;color:#eef1f5} #footer .footer_bas a,#footer .footer_bas span,#footer .footer_listes a,#footer .footer_listes li,#footer .footer_listes span{color:#a2a9ae} -#footer .footer_bas .nl:hover{text-decoration:none;color:#747b83} +#footer .footer_bas .nl:hover{color:#747b83} #footer .footer_bas{overflow:hidden;padding:5px 13px 10px;border-top:1px solid #2e3942;background:#16212c;color:#a2a9ae} #footer .footer_bas div,#footer .footer_bas p{float:left} #footer .sociaux{float:left;margin:10px 0 0;width:295px;color:#747b83;font-weight:700;font-size:12px} @@ -764,10 +772,9 @@ img[height="97"]+.ico29x29{bottom:6%;left:3.5%} #surheader .bt_abo{display:block;float:right;padding:0 16px;color:#000} #surheader .droit .services{float:right;height:25px} #surheader .droit .services>li{border-left:1px solid #626a72;border-right:1px solid #16212c} -#surheader .droit .services>li:hover{border-right:1px solid #fff} +#surheader .droit .services:hover>li>a,#surheader .droit .services>li:hover{border-right:1px solid #fff} #surheader .droit .services:hover{background:#fff} #surheader .droit .services>li>.obf{padding:0 10px;height:24px;line-height:24px} -#surheader .droit .services:hover>li>a{border-right:1px solid #fff} #surheader .droit .services:hover a{color:#000b15} #surheader .services li{position:relative;line-height:25px} #surheader .services div{display:none;position:absolute;right:0;top:25px;-webkit-box-shadow:0 2px 4px rgba(0,11,21,.5);-moz-box-shadow:0 2px 4px rgba(0,11,21,.5);box-shadow:0 2px 4px rgba(0,11,21,.5);width:340px;z-index:10;background:#fff} @@ -900,9 +907,9 @@ label i{font-style:normal;display:none} #nav_ariane ul{float:left;width:950px;overflow:hidden} #nav_ariane li{display:block;float:left} #nav_ariane a,#nav_ariane h1 span.obf{display:inline-block;height:23px;padding:12px 8px 0;font-size:1.2rem;line-height:100%;font-weight:700;white-space:nowrap} +#nav_ariane h1,.ie #nav_ariane .ariane a,.ie #nav_ariane .ariane span.obf,.ie #nav_ariane a{font-size:12px} #nav_ariane a:hover{text-decoration:none!important} #nav_ariane .ariane a,#nav_ariane .ariane h1{text-transform:uppercase} -#nav_ariane h1,.ie #nav_ariane a{font-size:12px} #nav_ariane .sous_rub{border-right:1px solid #e4e6e9} #nav_ariane .az{position:absolute;left:-9999px} #nav_ariane .ariane{position:relative;padding:0 13px 0 0;margin:0 0 0 -13px;border:none} @@ -916,7 +923,6 @@ label i{font-style:normal;display:none} #nav_ariane .ariane>a{color:#6a718b} #nav_ariane .ariane .obf:hover,#nav_ariane .ariane a:hover{color:#fff} #nav_ariane .ariane:first-child a{padding:12px 8px 0 25px} -.ie #nav_ariane .ariane a,.ie #nav_ariane .ariane span.obf{font-size:12px} .tt_rubrique{margin:7px 0 17px;padding-bottom:7px;border-bottom:3px solid #e9ecf0} #nav_ariane .actif+li a{padding-left:3px} #nav_ariane .sous_rub a:hover{color:#464f57} @@ -1268,9 +1274,10 @@ label i{font-style:normal;display:none} .conteneur_lives .lives.grand .chrome{background-color:#000b15} .conteneur_lives.popuped .lives .chrome{cursor:default} .conteneur_lives .live .bandeau .voir,.conteneur_lives .lives .chrome a{display:inline-block;text-decoration:none;float:right;margin:4px 0 0 5px;height:15px;width:14px} +.conteneur_lives .live.grand .toast,.conteneur_lives .live.moyen .bandeau,.conteneur_lives .live.moyen .cil,.conteneur_lives .live.petit .cil,.conteneur_lives .live.petit .toast,.conteneur_lives .lives .chrome .aide{display:none} +.conteneur_lives .live .toast .details a:hover,.conteneur_lives .live.grand .bandeau .titre a{text-decoration:underline} .conteneur_lives .live .bandeau .voir,.conteneur_lives .lives .chrome .live_deplier,.conteneur_lives .lives .chrome .live_fermer,.conteneur_lives .lives .chrome .live_replier,.conteneur_lives .lives .chrome .popup{background-image:url(/medias/web/img/sprites/icos_live.png)} .conteneur_lives .live .bandeau .voir{height:13px;background-position:-113px 0} -.conteneur_lives .live.grand .bandeau .titre a{text-decoration:underline} .conteneur_lives .lives .chrome .live_replier,.conteneur_lives .lives.grand .chrome .live_replier:hover{background-position:-17px -5px} .conteneur_lives .lives .chrome .live_replier:hover{background-position:-67px -5px} .conteneur_lives .lives .chrome .popup,.conteneur_lives .lives.grand .chrome .popup:hover{background-position:-34px 0} @@ -1281,16 +1288,12 @@ label i{font-style:normal;display:none} .conteneur_lives .lives .chrome .live_fermer:hover{background-position:-147px 1px} .conteneur_lives .lives.grand .chrome .live_deplier,.conteneur_lives .lives.grand .chrome .live_fermer,.conteneur_lives .lives.grand .chrome .live_replier,.conteneur_lives .lives.grand .chrome .popup{opacity:.6} .conteneur_lives .lives.grand .chrome .live_deplier:hover,.conteneur_lives .lives.grand .chrome .live_fermer:hover,.conteneur_lives .lives.grand .chrome .live_replier:hover,.conteneur_lives .lives.grand .chrome .popup:hover{opacity:1} -.conteneur_lives .lives .chrome .aide{display:none} .conteneur_lives .live .toast{padding:10px 20px;background:#16212c;color:#fff;width:288px} -.conteneur_lives .live.moyen .bandeau,.conteneur_lives .live.moyen .cil,.conteneur_lives .live.petit .cil,.conteneur_lives .live.petit .toast{display:none} .conteneur_lives .live.grand .bandeau{cursor:default} .conteneur_lives .live.grand .cil{padding:0;line-height:0;width:328px} -.conteneur_lives .live.grand .toast{display:none} .conteneur_lives .live .toast .heure{float:left;font-size:10px;color:#8b9299} .conteneur_lives .live .toast .details{margin-left:35px;height:75px;overflow:hidden;font-size:12px;line-height:120%;color:#fff} .conteneur_lives .live .toast .details a{color:#fff} -.conteneur_lives .live .toast .details a:hover{text-decoration:underline} #bandeau_bas .conteneur_lives .live .toast .btn{position:absolute;display:none;color:#000;height:18px;font-size:10px;line-height:18px;top:90px;left:200px;width:100px} #bandeau_bas .conteneur_lives .live:hover .toast .btn{display:block} .conteneur_lives .live.invisible{display:none} @@ -1316,9 +1319,8 @@ label i{font-style:normal;display:none} .txt_twit{color:#41c8f5} .txt_gris747{color:#747b83} .gris_moyen{color:#464f57} -.gris_clair{color:#a2a9ae} +.global.generique .entete_deroule,.gris_clair{color:#a2a9ae} .global.generique{border-top:3px solid #a2a9ae} -.global.generique .entete_deroule{color:#a2a9ae} .global.generique .bandeau{background:#a2a9ae} #nav.generique{border-top-color:#a2a9ae} #nav.generique li{border-top:3px solid #a2a9ae} @@ -1465,12 +1467,11 @@ label i{font-style:normal;display:none} #nav .vous:hover a{border-color:#820250} #nav.vous,#nav.vous li{border-top:3px solid #820250} #nav_ariane.vous .ariane{background:url(/medias/web/img/sprites/sous_nav.png)right -350px no-repeat} +.bg_abo,.global.abonnes .bandeau{background:#ffd500} #nav_ariane.vous .ariane>a{color:#fa9bbd} .ombrelle.vous .tt_rubrique_ombrelle,.ombrelle.vous h2 .obf,.ombrelle.vous h2 .obf:hover,.vous #ariane_az .obf:hover,.vous #ariane_az a:hover,.vous .couleur_rubrique,.vous .jour_parution,.vous .tt_rubrique{color:#820250} -.bg_abo{background:#ffd500} .global.abonnes{border-top:3px solid #ffd500} .global.abonnes .entete_deroule{color:#ffd500} -.global.abonnes .bandeau{background:#ffd500} #nav.accueil .abonnes{border-top-color:#ffd500} #nav .abonnes:hover{background:#ffd500;border-top-color:#ca0} #nav .abonnes:hover a{border-color:#ffd500} @@ -1726,7 +1727,7 @@ body.iframe{padding-top:0} #header-liberation .header-base .digitalpaper{position:relative;float:right;width:196px} #header-liberation .header-base .digitalpaper a.abo,#header-liberation .header-base .digitalpaper a.dl{display:block;position:absolute;top:15px;right:0;width:79px;height:34px;padding-left:10px;padding-top:7px;font-size:11px;font-family:Arial,Verdana,sans-serif} #header-liberation .header-base .digitalpaper a.abo{top:56px;padding-top:5px} -#header-liberation .header-base .digitalpaper a.une{position:absolute;right:88px;width:79px;height:102px;bottom:8px} +#header-liberation .header-base .digitalpaper a.une{position:absolute;right:88px;width:79px;height:102px;bottom:8px;box-shadow:0 -1px 7px 0 grey;-webkit-box-shadow:0 -1px 7px 0 grey;-moz-box-shadow:0 -1px 7px 0 grey} #header-liberation .header-base .digitalpaper a.une img{width:79px;height:102px} #header-liberation .header-base .digitalpaper .mask{display:block;position:absolute;bottom:0;right:0;width:180px;height:23px} #header-liberation .header-base .nav{height:59px} @@ -1950,6 +1951,7 @@ body.auth-unlogged #core-liberation .form-monlibe-unlogged form{opacity:.3;-ms-f #core-liberation .block-item-locked .btn-zoneabo{margin:0 0 15px 270px;width:158px} #core-liberation .block-item-locked .btn-zoneabo a{text-decoration:none;text-align:center} #core-liberation .block-item-locked .btn-zoneabo a:hover{text-decoration:underline} +#core-liberation .block-comments .block-content .comment_reply_links .comment_flag:hover,#core-liberation .block-comments .block-content .comment_reply_links .comment_reply:hover,#core-liberation .block-comments .headrest-community h3 a:hover{text-decoration:none} #core-liberation .block-item-locked p.already{font-size:10px;margin-bottom:0} #core-liberation .block-item-locked .offre-1-euro .offer{display:block;height:110px;margin-left:270px;padding-top:17px} #core-liberation .block-item-locked .offre-1-euro .offer h6{margin-bottom:10px;text-transform:uppercase} @@ -1991,9 +1993,7 @@ body.auth-unlogged #core-liberation .form-monlibe-unlogged form{opacity:.3;-ms-f #core-liberation .block-comments .block-content .comment_reply_links .comment_flag,#core-liberation .block-comments .block-content .comment_reply_links .comment_post_new{display:none;float:right;margin-right:10px;padding-top:5px} #core-liberation .block-comments .block-content .comment_reply_links .comment_flag .icon{position:static;display:block;width:13px;height:12px;float:left;background-image:url(http://s0.libe.com/libe/img/common/_sprites_icons/icons.png?9914d0d70a49);background-repeat:no-repeat;background-position:-33px -2px;margin:3px 6px 0 0} #core-liberation .block-comments .block-content .comment_reply_links .comment_flag:hover .icon{background-position:-33px -18px} -#core-liberation .block-comments .block-content .comment_reply_links .comment_flag:hover{text-decoration:none} #core-liberation .block-comments .block-content .comment_reply_links .comment_reply{display:none;float:right;padding:5px 10px 7px;border-radius:5px;-moz-border-radius:5px;-webkit-border-radius:5px} -#core-liberation .block-comments .block-content .comment_reply_links .comment_reply:hover{text-decoration:none} #core-liberation .block-comments .block-content .comment_libe>.comment_outer .meta .icon{position:absolute;right:0;top:0;display:block;width:36px;height:13px;background:url(http://s0.libe.com/libe/img/common/_sprites_icons/icons.png?9914d0d70a49)0 -84px no-repeat} #core-liberation .block-comments .block-content .comment_libe>.comment_outer .meta .details,#core-liberation .block-comments .block-content .comment_libe>.comment_outer .meta .note,#core-liberation .block-comments .block-content .comment_libe>.comment_outer .meta .who{padding-right:41px} #core-liberation .block-comments .block-content .is_removed>.comment_outer{padding:3px 8px 5px} @@ -2001,7 +2001,6 @@ body.auth-unlogged #core-liberation .form-monlibe-unlogged form{opacity:.3;-ms-f #core-liberation .block-comments .comment_replies{padding:10px;display:none;border-bottom:1px solid} #core-liberation .block-comments .comment_cutoff,#core-liberation .block-usercomments .comment_replies{display:block} #core-liberation .block-usercomments .noreplies{display:none} -#core-liberation .block-comments .headrest-community h3 a:hover{text-decoration:none} #core-liberation .block-comments .headrest-community a.folded:after,#core-liberation .block-comments .headrest-community a.unfolded:after{display:inline-block;content:'';background-image:url(http://s0.libe.com/libe/img/common/_sprites_icons/icons.png?9914d0d70a49);background-repeat:no-repeat} #core-liberation .block-comments .headrest-community a.folded:after{background-position:-85px -69px;margin:0 0 2px 7px;width:6px;height:8px} #core-liberation .block-comments .headrest-community a.unfolded:after{background-position:-76px -69px;margin:0 0 2px 7px;width:8px;height:7px} @@ -2182,6 +2181,7 @@ a.god:hover{background:#3c3c3c;color:#fff;text-decoration:none} #core-liberation .block-search-results .block-content h4 span{text-transform:uppercase} #core-liberation .block-search-results .block-content h4 strong{text-transform:uppercase;font-weight:400} #core-liberation .block-search-results .block-content h4 a:hover span{text-decoration:underline} +#core-liberation .cartridge a.btn-back:hover,#core-liberation .cartridge a.btn-comment:hover,#core-liberation .cartridge a.options-tab-label:hover,.btn-basic a,.btn-basic span{text-decoration:none} #core-liberation .block-search-results .block-content .category .object-content p{margin-top:0;font-family:Georgia,"Times New Roman",Times,serif;font-size:16px} #core-liberation .block-search-results .block-content .object-picture{position:absolute;width:87px} #core-liberation .block-search-results .block-content .object-picture img{display:block;width:87px} @@ -2223,14 +2223,12 @@ a.god:hover{background:#3c3c3c;color:#fff;text-decoration:none} #core-liberation .cartridge .share li a.star{margin-top:4px} #core-liberation .cartridge .btn-back,#core-liberation .cartridge .btn-comment{text-align:center} #core-liberation .cartridge .btn-back span,#core-liberation .cartridge .btn-comment span{display:block;padding:6px 7px 0;font-weight:700} -#core-liberation .cartridge a.btn-back:hover,#core-liberation .cartridge a.btn-comment:hover{text-decoration:none} #core-liberation .cartridge a.btn-comment-disabled{background:url(http://s0.libe.com/libe/img/common/bg-btn-comment.png?593ec6d1f747)} #core-liberation .cartridge a.btn-comment-disabled:hover{cursor:default} #core-liberation .cartridge .options-tab{position:relative} #core-liberation .cartridge .options-tab-content{display:none;position:absolute;padding:5px 9px 8px;border:1px solid;width:180px;text-align:right;right:8px;font-size:11px;z-index:100} #core-liberation .cartridge .options-tab-content a{display:block} #core-liberation .cartridge a.options-tab-label{display:block;position:relative;width:100px;margin:3px 8px 0 0;padding:3px 7px 5px;border-radius:8px 8px 0 0;-moz-border-radius:8px 8px 0 0;-webkit-border-radius:8px 8px 0 0} -#core-liberation .cartridge a.options-tab-label:hover{text-decoration:none} #core-liberation .cartridge a.options-tab-label .arrow{position:absolute;right:6px;top:8px} #core-liberation .cartridge-basic-rounded{border:1px dotted;height:30px} #core-liberation .cartridge-basic-rounded p{padding:6px 10px 0} @@ -2249,7 +2247,7 @@ a.god:hover{background:#3c3c3c;color:#fff;text-decoration:none} #core-liberation .cartridge-basic-bubble .share{width:115px} #core-liberation .cartridge-basic-bubble .btn-back,#core-liberation .cartridge-basic-bubble .text{width:150px} #core-liberation .block-item .cartridge-basic-bubble .btn-comment{width:100px} -.btn-basic a,.btn-basic span{display:block;padding:2px 1px 4px;text-decoration:none;text-align:center;font-size:11px;border:1px solid} +.btn-basic a,.btn-basic span{display:block;padding:2px 1px 4px;text-align:center;font-size:11px;border:1px solid} form .btn-basic input[type=button],form .btn-basic input[type=reset],form .btn-basic input[type=submit]{border:1px solid;padding:0 10px 4px;height:26px;cursor:pointer;cursor:hand;font-size:11px;font-family:Verdana,sans-serif} .btn-laune a,.btn-laune span,.btn-monlibe a,.btn-monlibe span,.btn-zoneabo a,.btn-zoneabo span{display:block;padding:5px 5px 7px;border-radius:5px;-moz-border-radius:5px;-webkit-border-radius:5px;text-decoration:none} .btn-laune a:hover,.btn-monlibe a:hover,.btn-zoneabo a:hover{text-decoration:underline} @@ -2257,8 +2255,8 @@ form .btn-laune input[type=button],form .btn-laune input[type=reset],form .btn-l form .btn-monlibe input[type=reset]{opacity:.9} .btn-rounded-degraded a,.btn-rounded-degraded span{display:block;border-radius:5px;-moz-border-radius:5px;-webkit-border-radius:5px;padding:7px 14px 11px;text-decoration:none;text-align:center;font-size:13px;font-weight:700} .btn-rounded-degraded a:hover,.btn-rounded-degraded span:hover{text-decoration:none!important} +#bar-liberation a,#bar-liberation a p,.site-liberation .toolbox .comment:hover,.site-liberation .toolbox .facebook:hover,.site-liberation .toolbox .twitter,.site-liberation .toolbox .txt-min:hover,.site-liberation .toolbox .txt-plus:hover,.site-liberation .toolbox .txt-reset:hover,form .btn-rounded-degraded input[type=button]:focus,form .btn-rounded-degraded input[type=button]:hover,form .btn-rounded-degraded input[type=submit]:focus,form .btn-rounded-degraded input[type=submit]:hover{text-decoration:none} form .btn-rounded-degraded input[type=button],form .btn-rounded-degraded input[type=submit]{border-radius:5px;-moz-border-radius:5px;-webkit-border-radius:5px;border:0;padding:0 10px 6px;height:35px;cursor:pointer;cursor:hand;font-size:13px;font-family:Verdana,sans-serif;font-weight:700} -form .btn-rounded-degraded input[type=button]:focus,form .btn-rounded-degraded input[type=button]:hover,form .btn-rounded-degraded input[type=submit]:focus,form .btn-rounded-degraded input[type=submit]:hover{text-decoration:none} .btn-read-digitalpaper{display:block;border:1px solid;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;padding:5px 7px 7px} .btn-read-digitalpaper a,.btn-read-digitalpaper span{display:block;min-height:32px;background:url(http://s0.libe.com/libe/img/common/reader_picto.png?8fdcc4850538)right top no-repeat;padding-right:50px;font-size:12px} #core-liberation .pagination{float:none;margin-bottom:14px;margin-top:21px;border-top:1px dotted;border-bottom:1px dotted;padding-top:3px;text-align:center} @@ -2292,7 +2290,6 @@ form .btn-rounded-degraded input[type=button]:focus,form .btn-rounded-degraded i #core-liberation .toolbox li.spacer span{display:block;width:1px;height:20px;margin-top:5px} #core-liberation .toolbox .txt-min,#core-liberation .toolbox .txt-plus{display:block;font-size:15px;padding-top:4px} #core-liberation .toolbox .txt-reset{display:block;font-family:"Times New Roman",Times,Georgia,serif;font-size:19px;padding:4px 0 0 3px} -.site-liberation .toolbox .comment:hover,.site-liberation .toolbox .facebook:hover,.site-liberation .toolbox .twitter,.site-liberation .toolbox .txt-min:hover,.site-liberation .toolbox .txt-plus:hover,.site-liberation .toolbox .txt-reset:hover{text-decoration:none} .site-liberation .toolbox li a span{display:block} .site-liberation .toolbox li a.print span{margin-top:7px;width:16px;height:16px} .site-liberation .toolbox li a.favorite span{margin-top:5px;width:20px;height:18px} @@ -2320,7 +2317,7 @@ form .btn-rounded-degraded input[type=button]:focus,form .btn-rounded-degraded i #core-liberation .sb-podcasts ul li a.xml{background-position:-322px 0;width:41px} #bar-liberation{display:block;position:fixed;top:0;left:0;z-index:10000;width:100%;height:40px;border-bottom:1px solid;font-family:Arial,Verdana,sans-serif;font-size:12px;line-height:14px} body.init-bar-is-closed #bar-liberation{height:15px} -#bar-liberation a,#bar-liberation a p{text-decoration:none;outline:0} +#bar-liberation a,#bar-liberation a p{outline:0} #bar-liberation a:hover{text-decoration:none} #bar-liberation .content{position:relative;margin:auto;height:40px;width:1068px} #bar-liberation .content .activities-stream,#bar-liberation .content .close,#bar-liberation .content .login,#bar-liberation .content .mail-box,#bar-liberation .content .open,#bar-liberation .content .other,#bar-liberation .content .personal-options{display:none;border-left:1px solid;border-right:1px solid;border-bottom:1px solid;position:absolute;top:0;height:40px} @@ -2342,6 +2339,7 @@ body.init-bar-is-closed #bar-liberation{height:15px} #bar-liberation .content .login h3{font-family:Verdana,sans-serif;font-weight:400;font-size:12px;padding:12px 10px 0} #bar-liberation .content .login a.subscribe{position:absolute;display:block;top:10px;right:230px;padding:3px 10px;border-radius:5px;-moz-border-radius:5px;-webkit-border-radius:5px} #bar-liberation .content .login a.subscribe:hover{text-decoration:none} +#bar-liberation #login-box-content p.forgot-password a:hover,#bar-liberation #personal-options-content ul li a:hover{text-decoration:underline} #bar-liberation .content .login span{position:absolute;display:block;top:13px;right:205px} #bar-liberation .content .login a.connect{position:absolute;display:block;top:13px;right:120px;font-weight:700} #bar-liberation #login-box-content{display:none;position:absolute;border-left:1px solid;border-right:1px solid;border-bottom:1px solid;top:40px;right:0;z-index:10025;width:184px;padding:10px} @@ -2351,7 +2349,6 @@ body.init-bar-is-closed #bar-liberation{height:15px} #bar-liberation #login-box-content form input[type=checkbox]{display:block;float:right} #bar-liberation #login-box-content form .btn-basic{margin:10px 0} #bar-liberation #login-box-content p.forgot-password{font-size:11px;text-align:right} -#bar-liberation #login-box-content p.forgot-password a:hover{text-decoration:underline} #bar-liberation .content .personal-options{width:189px;left:29px;z-index:10020} #bar-liberation .content .personal-options a{display:block;width:100%;height:100%} #bar-liberation .content .personal-options img.visual{display:block;position:absolute;top:8px;left:8px;width:23px;height:23px} @@ -2361,7 +2358,6 @@ body.init-bar-is-closed #bar-liberation{height:15px} #bar-liberation #personal-options-content ul.account{width:160px;padding-left:10px} #bar-liberation #personal-options-content ul.subscription{width:149px} #bar-liberation #personal-options-content ul.subscription li.subscribe{position:absolute;bottom:17px} -#bar-liberation #personal-options-content ul li a:hover{text-decoration:underline} #bar-liberation #personal-options-content ul li{padding:0 10px 4px} #bar-liberation #personal-options-content ul li.spacer{height:5px} #bar-liberation #personal-options-content ul li.indent{padding-left:20px} @@ -2373,6 +2369,7 @@ body.init-bar-is-closed #bar-liberation{height:15px} #bar-liberation .content .activities-stream{width:503px;left:295px;z-index:10030;height:40px;overflow:hidden;border-bottom:1px solid} #bar-liberation .content .activities-stream a.displayer{display:block;position:absolute;width:40px;height:100%;right:0} #bar-liberation .content .activities-stream a:hover{text-decoration:underline} +#page-paywall .content a,.site-liberation a:hover h5 .theme,.site-liberation h5 a.theme:hover{text-decoration:none} #bar-liberation .content .other{width:267px;left:799px;z-index:10050} #bar-liberation .content .other a{display:block;height:100%;width:100%} #bar-liberation .content .other .ad-1{padding:6px 10px} @@ -2394,7 +2391,6 @@ body.init-bar-is-closed #bar-liberation{height:15px} #page-mailfriend .content label{float:left;display:block;width:80%;font-weight:700} #page-paywall{width:520px;font-family:Verdana,sans-serif;font-size:12px} #page-paywall .content{position:relative;padding:20px 0} -#page-paywall .content a{text-decoration:none} #page-paywall .content a.close{display:block;float:right} #page-paywall .content a.close span{background:url(http://s0.libe.com/libe/img/common/_sprites_icons/icons.png?9914d0d70a49)-20px -98px no-repeat;display:block;margin:auto;width:15px;height:15px} #page-paywall .content a.close strong{text-transform:uppercase;font-size:8px} @@ -2427,12 +2423,11 @@ body.access-ess #page-paywall .content .arguments .arg{float:none;margin:auto} #page-paywall .content .form-login form p input[type=password]:focus,#page-paywall .content .form-login form p input[type=text]:focus{border:1px solid} #page-paywall .content .form-login form .btn-basic{margin-top:20px;float:right} .site-liberation{font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px} -.site-liberation h1,.site-liberation h2{font-family:Georgia,"Times New Roman",Times,serif;font-size:26px} -.site-liberation h3{font-family:Georgia,"Times New Roman",Times,serif} +.site-liberation h1,.site-liberation h2,.site-liberation h3{font-family:Georgia,"Times New Roman",Times,serif} +.site-liberation h1,.site-liberation h2{font-size:26px} .site-liberation h4{font-family:Georgia,"Times New Roman",Times,serif;font-size:14px;font-weight:400} .site-liberation h5{font-size:12px} .site-liberation h5 .theme{text-transform:uppercase} -.site-liberation a:hover h5 .theme,.site-liberation h5 a.theme:hover{text-decoration:none} .site-liberation h5 .date{font-weight:400;font-size:10px} .site-liberation p{font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px} .site-liberation p.subtitle{line-height:16px} @@ -2460,7 +2455,7 @@ body.access-ess #page-paywall .content .arguments .arg{float:none;margin:auto} .site-liberation .author{font-size:10px} .site-liberation .author strong{text-transform:uppercase} .site-liberation a,.site-liberation a p{text-decoration:none;outline:0} -.site-liberation a:hover,.site-liberation a:hover h2,.site-liberation a:hover h3,.site-liberation a:hover h4,.site-liberation a:hover h5,.site-liberation a:hover h6,.site-liberation a:hover p{text-decoration:underline} +.site-liberation .block-call-items .mini-tpl .whosaid h5 a.theme:hover,.site-liberation a:hover,.site-liberation a:hover h2,.site-liberation a:hover h3,.site-liberation a:hover h4,.site-liberation a:hover h5,.site-liberation a:hover h6,.site-liberation a:hover p{text-decoration:underline} .site-liberation .lnk-comments{background:url(http://s0.libe.com/libe/img/common/ico-lnk-comment.png?48525c2557e6)left 2px no-repeat;padding-left:20px;font-size:10px;line-height:15px} .site-liberation .block-call-items .block-top{margin-bottom:10px} .site-liberation .block-call-items .block-top h5{padding:3px 10px;background-color:#e20000;color:#fff} @@ -2497,7 +2492,6 @@ body.access-ess #page-paywall .content .arguments .arg{float:none;margin:auto} .site-liberation .block-call-items .mini-tpl .label .visual{width:45px;margin:0 10px 0 0} .site-liberation .block-call-items .mini-tpl .whosaid{position:relative;margin-bottom:7px;padding:14px} .site-liberation .block-call-items .mini-tpl .whosaid h5 .theme{font-size:14px} -.site-liberation .block-call-items .mini-tpl .whosaid h5 a.theme:hover{text-decoration:underline} .site-liberation .block-call-items .mini-tpl .whosaid h3{font-size:26px;font-weight:400;margin-bottom:28px} .site-liberation .block-call-items .mini-tpl .whosaid a.zap{display:block;position:absolute;width:78px;height:21px;background:url(http://s0.libe.com/libe/img/common/btn_shaker.gif?6340e450364b)no-repeat;bottom:14px;right:14px} .site-liberation .block-call-items .mini-tpl .whosaid .answer{margin-top:10px} @@ -2640,7 +2634,6 @@ body.slideshow .ad-top .megaban{background:#333} .site-liberation #footer-liberation .hot-topics .event a{color:#fff} #header-liberation .header-base .digitalpaper a.abo,#header-liberation .header-base .digitalpaper a.dl{color:#fff} #header-liberation .header-base .digitalpaper a.abo{background-color:#f2f2f2;color:#2e2e2e} -#header-liberation .header-base .digitalpaper a.une{box-shadow:0 -1px 7px 0 grey;-webkit-box-shadow:0 -1px 7px 0 grey;-moz-box-shadow:0 -1px 7px 0 grey} #header-liberation .header-base .digitalpaper .mask{background:#fff;box-shadow:7px -12px 8px -10px grey;-webkit-box-shadow:7px -12px 8px -10px grey;-moz-box-shadow:7px -12px 8px -10px grey} #header-liberation .header-base .nav .nav1 a:hover,#header-liberation .header-base .nav .on .nav1 a,#header-liberation .header-base .nav-no-js>li:hover .nav1 a{color:#fff} #header-liberation .header-base .nav .nav1 a:hover span,#header-liberation .header-base .nav .on .nav1 a span,#header-liberation .header-base .nav-no-js>li:hover .nav1 a span{background-color:#fff} @@ -2733,11 +2726,11 @@ body.slideshow .ad-top .megaban{background:#333} .site-liberation .col-contextual .block-nobg .block-top{border-bottom-color:#e20000} .site-liberation .col-contextual .block-solid-c2{background-color:#333;color:#c6c6c6} .site-liberation .col-contextual .block-solid-c2 .block-top{color:#c6c6c6;border-bottom-color:#c6c6c6} +.site-liberation .block-call-items .mini-tpl,.site-liberation .block-call-items .tpl-breaking-news,.site-liberation .block-call-items .tpl-breaking-news:last-of-type,.site-liberation .block-call-items .tpl-flash-news-29col,.site-liberation .block-call-items .tpl-flash-news-29col:last-of-type{border-bottom-color:#ddd} .site-liberation .col-contextual .block-solid-c2 a,.site-liberation .col-contextual .block-solid-c2 a p{color:#c6c6c6} .site-liberation .col-part .block{background-color:#d7d7d7} .site-liberation .col-part .block .block-top{color:#fff} .site-liberation .col-part .block hr{border-top-color:#ccc} -.site-liberation .block-call-items .mini-tpl{border-bottom-color:#ddd} .site-liberation .block-call-items .mini-tpl .light{color:#bbbaba} .site-liberation .block-call-items .mini-tpl .label{border-color:#e7e7e7} .site-liberation .block-call-items .mini-tpl .whosaid{background-color:#e20000} @@ -2745,7 +2738,6 @@ body.slideshow .ad-top .megaban{background:#333} .site-liberation .block-call-items .mini-tpl .whosaid h3 a{color:#fafafa} .site-liberation .block-call-items .mini-tpl .whosaid a{color:#2e2e2e} .site-liberation .block-call-items .list-linked-items span{color:#e20000} -.site-liberation .block-call-items .tpl-breaking-news,.site-liberation .block-call-items .tpl-breaking-news:last-of-type,.site-liberation .block-call-items .tpl-flash-news-29col,.site-liberation .block-call-items .tpl-flash-news-29col:last-of-type{border-bottom-color:#ddd} .site-liberation .block-call-items .tpl-spotlight .item{background-color:#cecece} .site-liberation .block-call-items .tpl-spotlight .details{border-top-color:#aaa} .site-liberation .block-call-items .tpl-spotlight h5 .date{color:#555} @@ -2767,6 +2759,7 @@ body.slideshow .ad-top .megaban{background:#333} #core-liberation .block-item .object-picture .legende{color:#838383} .site-liberation .block-item .object-content a:hover{color:#e20000} #core-liberation .block-item-locked{border-top-color:#c1b0bb;border-bottom-color:#c1b0bb;background:#fff;background:-moz-linear-gradient(top,#dbdad6 0,#fff 2%,#fff 98%,#e1e0de 100%);background:-webkit-gradient(linear,left top,left bottom,color-stop(0,#dbdad6),color-stop(2%,#fff),color-stop(98%,#fff),color-stop(100%,#e1e0de));background:-o-linear-gradient(top,#dbdad6 0,#fff 2%,#fff 98%,#e1e0de 100%)} +#core-liberation .block-all-forums .forum,#core-liberation .block-all-forums .headrest,#core-liberation .block-comments .comment_replies{border-bottom-color:#ddd} #core-liberation .block-item-locked .block-top span{background-color:#fff} #core-liberation .block-item-locked .btn-zoneabo a:hover{color:#fff} #core-liberation .block-item-read-more{border-color:#ddd} @@ -2791,7 +2784,6 @@ body.slideshow .ad-top .megaban{background:#333} #core-liberation .block-comments .block-content .comment_libe>.comment_outer{background:#f8f8f8} #core-liberation .block-comments .block-content .is_removed>.comment_outer{background-color:#878787;color:#fff} #core-liberation .block-comments .comment_replies_count{background:#F8F8F8} -#core-liberation .block-comments .comment_replies{border-bottom-color:#ddd} #core-liberation .block-comments .headrest-community h3 a{color:#555} #core-liberation .block-pager-labo{background-color:#e7e7e7} #core-liberation .block-pager-labo .block-bottom{border-top-color:#222} @@ -2803,10 +2795,8 @@ body.slideshow .ad-top .megaban{background:#333} #core-liberation .block-np .tomorrow .progress-bar .done{background-color:#ee3e30} #core-liberation .block-np .block-content .railway ul li img{border-color:#222} #core-liberation .block-np .from ul li img.visual{border-color:#878787} -#core-liberation .block-all-forums .headrest{border-bottom-color:#ddd} #core-liberation .block-all-forums .headrest h4{color:#555} #core-liberation .block-all-forums .headrest h5{color:#fa9900} -#core-liberation .block-all-forums .forum{border-bottom-color:#ddd} #core-liberation .block-all-forums .forum h5.title,#core-liberation .block-all-forums .forum span.infos,#core-liberation .block-all-forums .forum span.infos a{color:#555} #core-liberation .block-all-blogs .block-content .headrest{border-bottom-color:#ddd} #core-liberation .block-all-blogs .headrest h4{color:#e20000} diff --git a/test/fixtures/blueprint-min.css b/test/fixtures/blueprint-min.css index 3651f8fe..38754c54 100644 --- a/test/fixtures/blueprint-min.css +++ b/test/fixtures/blueprint-min.css @@ -1,5 +1,6 @@ html{margin:0;padding:0;border:0} a,abbr,acronym,address,article,aside,blockquote,body,caption,code,dd,del,dfn,dialog,div,dl,dt,em,fieldset,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,iframe,img,label,legend,li,nav,object,ol,p,pre,q,section,span,table,tbody,td,tfoot,th,thead,tr,ul{margin:0;padding:0;border:0;font-weight:inherit;font-style:inherit;font-size:100%;font-family:inherit;vertical-align:baseline} +blockquote,dfn,em{font-style:italic} article,aside,dialog,figure,footer,header,hgroup,nav,section{display:block} body{line-height:1.5} table{border-collapse:separate;border-spacing:0} @@ -12,12 +13,13 @@ a img{border:none} html{font-size:100.01%} body{font-size:75%;color:#222;background:#fff;font-family:"Helvetica Neue",Arial,Helvetica,sans-serif} h1,h2,h3,h4,h5,h6{font-weight:400;color:#111} +dfn,dl dt,h5,h6,strong,th{font-weight:700} h1{font-size:3em;line-height:1;margin-bottom:.5em} h2{font-size:2em;margin-bottom:.75em} h3{font-size:1.5em;line-height:1;margin-bottom:1em} h4{font-size:1.2em;line-height:1.25;margin-bottom:1.25em} -h5{font-size:1em;font-weight:700;margin-bottom:1.5em} -h6{font-size:1em;font-weight:700} +h5,h6{font-size:1em} +h5{margin-bottom:1.5em} h1 img,h2 img,h3 img,h4 img,h5 img,h6 img{margin:0} p{margin:0 0 1.5em} .left{float:left!important} @@ -26,15 +28,14 @@ p .left{margin:1.5em 1.5em 1.5em 0;padding:0} p .right{margin:1.5em 0 1.5em 1.5em;padding:0} a:focus,a:hover{color:#09f} a{color:#06c;text-decoration:underline} -blockquote{margin:1.5em;color:#666;font-style:italic} -dfn,dl dt,strong,th{font-weight:700} -dfn,em{font-style:italic} +blockquote{margin:1.5em;color:#666} sub,sup{line-height:0} abbr,acronym{border-bottom:1px dotted #666} address{margin:0 0 1.5em;font-style:italic} del{color:#666} pre{margin:1.5em 0;white-space:pre} code,pre,tt{font:1em 'andale mono','lucida console',monospace;line-height:1.5} +label,legend{font-weight:700} li ol,li ul{margin:0} ol,ul{margin:0 1.5em 1.5em 0;padding-left:1.5em} ul{list-style-type:disc} @@ -59,9 +60,8 @@ caption{background:#eee} .last{padding-right:0} .top{margin-top:0;padding-top:0} .bottom{margin-bottom:0;padding-bottom:0} -label{font-weight:700} fieldset{padding:0 1.4em 1.4em;margin:0 0 1.5em;border:1px solid #ccc} -legend{font-weight:700;font-size:1.2em} +legend{font-size:1.2em} #IE8#HACK,fieldset{padding-top:1.4em} #IE8#HACK,legend{margin-top:0;margin-bottom:0} input.text,input.title,input[type=password],input[type=text],textarea{background-color:#fff;border:1px solid #bbb} diff --git a/test/fixtures/issue-437-min.css b/test/fixtures/issue-437-min.css new file mode 100644 index 00000000..01be134b --- /dev/null +++ b/test/fixtures/issue-437-min.css @@ -0,0 +1,3 @@ +.one,.two{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACPklEQVQ4jaWST0jTARTHv+/9fm46XcOxFCxpObE1igiiCKMMCjqZThGLoINBIUR0K4quFSHRxQ4ZFEiWqSuK8GSnLiGUHZwZcxNLysw/8//P/d7rNpzUKnq39w4fvt/3/QL/ObT+cN/nc3vc3kaTzaOwUt01Y8NPsgHMtUvnpvL9Zq6jnUVHoBoRh/36rxU89QerDMYzIblQHxt+2OErLTHczj1EJCqr/Q2JxNffAtrh3eDaWvwBjEvfY9HuYn/wJgycUaH3RMRC2MUpvWuNRq82ANZaAANAXmDjOWYaCMeij4sCoRY1sG9+ei5UG48erBkZPMDTMyE1tdLhD974pYJIINSroo8WZ5N9Lo97GLzqT4kU5iDvlrJsYMX5peTCjzxP/pAtKzvr4vHRDAUCfQO2enNdBV5mXAzHYhMm5+5WtVsVeCDg1hOTY+Oq9NYQ55Uuf8W1nrLtr9KArF+27fVRzzMAVj2cBjCoEuI4trw4PyWC2z2BQFFKlt8RGc0wjNMMae7wlZYQ6V6bV+6AjISCh9ZYsPuYqe7U1JfPxNxGyIlYs9ZCbXywOhwbqsJMcsbpye+Cjba6eHwUhEZbU5H0EzvLyjymOgdIU5cnEp+6ssXoKK2ohcnXv60kd5wdH19M++vcXH7IdJjPsxWpe8u2JjKoBaThcOxjX0YTgXVVJkQsWeqxkqumq9ATJtVqJfKLtdxYPzbSn9GDDAhQkBMIniTwERF9qQovG3rcVnkxm5y61zQ5Ofen5P5pfgKK5A55njIWAwAAAABJRU5ErkJggg==);background-size:120px 240px} +.one{background-position:0 -200px} +.two{background-position:-40px -200px} diff --git a/test/fixtures/issue-437.css b/test/fixtures/issue-437.css new file mode 100644 index 00000000..125ebb40 --- /dev/null +++ b/test/fixtures/issue-437.css @@ -0,0 +1,10 @@ +.one { + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACPklEQVQ4jaWST0jTARTHv+/9fm46XcOxFCxpObE1igiiCKMMCjqZThGLoINBIUR0K4quFSHRxQ4ZFEiWqSuK8GSnLiGUHZwZcxNLysw/8//P/d7rNpzUKnq39w4fvt/3/QL/ObT+cN/nc3vc3kaTzaOwUt01Y8NPsgHMtUvnpvL9Zq6jnUVHoBoRh/36rxU89QerDMYzIblQHxt+2OErLTHczj1EJCqr/Q2JxNffAtrh3eDaWvwBjEvfY9HuYn/wJgycUaH3RMRC2MUpvWuNRq82ANZaAANAXmDjOWYaCMeij4sCoRY1sG9+ei5UG48erBkZPMDTMyE1tdLhD974pYJIINSroo8WZ5N9Lo97GLzqT4kU5iDvlrJsYMX5peTCjzxP/pAtKzvr4vHRDAUCfQO2enNdBV5mXAzHYhMm5+5WtVsVeCDg1hOTY+Oq9NYQ55Uuf8W1nrLtr9KArF+27fVRzzMAVj2cBjCoEuI4trw4PyWC2z2BQFFKlt8RGc0wjNMMae7wlZYQ6V6bV+6AjISCh9ZYsPuYqe7U1JfPxNxGyIlYs9ZCbXywOhwbqsJMcsbpye+Cjba6eHwUhEZbU5H0EzvLyjymOgdIU5cnEp+6ssXoKK2ohcnXv60kd5wdH19M++vcXH7IdJjPsxWpe8u2JjKoBaThcOxjX0YTgXVVJkQsWeqxkqumq9ATJtVqJfKLtdxYPzbSn9GDDAhQkBMIniTwERF9qQovG3rcVnkxm5y61zQ5Ofen5P5pfgKK5A55njIWAwAAAABJRU5ErkJggg==); + background-position: 0 -200px; + background-size: 120px 240px; +} +.two { + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACPklEQVQ4jaWST0jTARTHv+/9fm46XcOxFCxpObE1igiiCKMMCjqZThGLoINBIUR0K4quFSHRxQ4ZFEiWqSuK8GSnLiGUHZwZcxNLysw/8//P/d7rNpzUKnq39w4fvt/3/QL/ObT+cN/nc3vc3kaTzaOwUt01Y8NPsgHMtUvnpvL9Zq6jnUVHoBoRh/36rxU89QerDMYzIblQHxt+2OErLTHczj1EJCqr/Q2JxNffAtrh3eDaWvwBjEvfY9HuYn/wJgycUaH3RMRC2MUpvWuNRq82ANZaAANAXmDjOWYaCMeij4sCoRY1sG9+ei5UG48erBkZPMDTMyE1tdLhD974pYJIINSroo8WZ5N9Lo97GLzqT4kU5iDvlrJsYMX5peTCjzxP/pAtKzvr4vHRDAUCfQO2enNdBV5mXAzHYhMm5+5WtVsVeCDg1hOTY+Oq9NYQ55Uuf8W1nrLtr9KArF+27fVRzzMAVj2cBjCoEuI4trw4PyWC2z2BQFFKlt8RGc0wjNMMae7wlZYQ6V6bV+6AjISCh9ZYsPuYqe7U1JfPxNxGyIlYs9ZCbXywOhwbqsJMcsbpye+Cjba6eHwUhEZbU5H0EzvLyjymOgdIU5cnEp+6ssXoKK2ohcnXv60kd5wdH19M++vcXH7IdJjPsxWpe8u2JjKoBaThcOxjX0YTgXVVJkQsWeqxkqumq9ATJtVqJfKLtdxYPzbSn9GDDAhQkBMIniTwERF9qQovG3rcVnkxm5y61zQ5Ofen5P5pfgKK5A55njIWAwAAAABJRU5ErkJggg==); + background-position: -40px -200px; + background-size: 120px 240px; +} diff --git a/test/integration-test.js b/test/integration-test.js index c1b13835..6d8299a9 100644 --- a/test/integration-test.js +++ b/test/integration-test.js @@ -1741,7 +1741,7 @@ title']{display:block}", ], 'two same bodies over a block': [ '.one{color:red}@media print{.two{display:block}}.three{color:red}', - '.one{color:red}@media print{.two{display:block}}.three{color:red}' + '.one,.three{color:red}@media print{.two{display:block}}' ] }), 'same non-adjacent selectors': cssContext({ @@ -1772,7 +1772,7 @@ title']{display:block}", ], 'when overriden by a complex selector': [ 'a{padding:10px;margin:0;color:red}.one{color:red}a,p{color:red;padding:0}', - 'a{margin:0}.one{color:red}a,p{color:red;padding:0}' + '.one,a,p{color:red}a{margin:0}a,p{padding:0}' ], 'when overriden by complex selectors': [ 'a{padding:10px;margin:0;color:red}.one{color:red}a,p{color:red;padding:0}.one,a{color:#fff}', diff --git a/test/selectors/optimizer-test.js b/test/selectors/optimizer-test.js index 4bc43a4d..f84cb1b7 100644 --- a/test/selectors/optimizer-test.js +++ b/test/selectors/optimizer-test.js @@ -89,6 +89,70 @@ vows.describe(SelectorsOptimizer) ] }) ) + .addBatch( + optimizerContext('selectors - restructuring', { + 'up until changed': [ + 'a{color:#000}div{color:red}.one{display:block}.two{display:inline;color:red}', + 'a{color:#000}.two,div{color:red}.one{display:block}.two{display:inline}' + ], + 'up until top': [ + 'a{width:100px}div{color:red}.one{display:block}.two{display:inline;color:red}', + '.two,div{color:red}a{width:100px}.one{display:block}.two{display:inline}' + ], + 'up until top with charset': [ + '@charset "utf-8";a{width:100px}div{color:red}.one{display:block}.two{display:inline;color:red}', + '@charset "utf-8";.two,div{color:red}a{width:100px}.one{display:block}.two{display:inline}' + ], + 'over shorthands': [ + 'div{margin-top:0}.one{margin:0}.two{display:block;margin-top:0}', + 'div{margin-top:0}.one{margin:0}.two{display:block;margin-top:0}' + ], + 'over shorthands with flush': [ + 'div{margin-top:0}.one{margin:0}.two{display:block;margin-top:0}.three{color:red}.four{margin-top:0}', + 'div{margin-top:0}.one{margin:0}.four,.two{margin-top:0}.two{display:block}.three{color:red}' + ], + 'over granular': [ + 'div{margin-top:0}.one{margin-bottom:0}.two{display:block;margin-top:0}', + '.two,div{margin-top:0}.one{margin-bottom:0}.two{display:block}' + ], + 'over granular with shorthand': [ + 'div{margin:0}.one{margin-bottom:0}.two{display:block;margin:0}', + 'div{margin:0}.one{margin-bottom:0}.two{display:block;margin:0}' + ], + 'over media without overriding': [ + 'div{margin:0}@media{.one{color:red}}.two{display:block;margin:0}', + '.two,div{margin:0}@media{.one{color:red}}.two{display:block}' + ], + 'over media with overriding by different value': [ + 'div{margin:0}@media{.one{margin:10px}}.two{display:block;margin:0}', + 'div{margin:0}@media{.one{margin:10px}}.two{display:block;margin:0}' + ], + 'over media with overriding by same value': [ + 'div{margin:0}@media{.one{margin:0}}.two{display:block;margin:0}', + '.two,div{margin:0}@media{.one{margin:0}}.two{display:block}' + ], + 'over media with overriding by a granular': [ + 'div{margin:0}@media{.one{margin-bottom:0}}.two{display:block;margin:0}', + 'div{margin:0}@media{.one{margin-bottom:0}}.two{display:block;margin:0}' + ], + 'over media with overriding by a different granular': [ + 'div{margin-top:0}@media{.one{margin-bottom:0}}.two{display:block;margin-top:0}', + '.two,div{margin-top:0}@media{.one{margin-bottom:0}}.two{display:block}' + ], + 'over media with a new property': [ + 'div{margin-top:0}@media{.one{margin-top:0}}.two{display:block;margin:0}', + 'div{margin-top:0}@media{.one{margin-top:0}}.two{display:block;margin:0}' + ], + 'multiple granular up to a shorthand': [ + '.one{border:1px solid #bbb}.two{border-color:#666}.three{border-width:1px;border-style:solid}', + '.one{border:1px solid #bbb}.two{border-color:#666}.three{border-width:1px;border-style:solid}' + ], + 'multiple granular - complex case': [ + '.one{background:red;padding:8px 16px}.two{padding-left:16px;padding-right:16px}.three{padding-top:20px}.four{border-left:1px solid #000;border-right:1px solid #000;border-bottom:1px solid #000}.five{background-color:#fff;background-image:-moz-linear-gradient();background-image:-ms-linear-gradient();background-image:-webkit-gradient();background-image:-webkit-linear-gradient()}', + '.one{background:red;padding:8px 16px}.two{padding-left:16px;padding-right:16px}.three{padding-top:20px}.four{border-left:1px solid #000;border-right:1px solid #000;border-bottom:1px solid #000}.five{background-color:#fff;background-image:-moz-linear-gradient();background-image:-ms-linear-gradient();background-image:-webkit-gradient();background-image:-webkit-linear-gradient()}' + ] + }, { advanced: true }) + ) .addBatch( optimizerContext('properties', { 'empty body': [ @@ -153,7 +217,7 @@ vows.describe(SelectorsOptimizer) ], 'non-adjacent with multi selectors': [ 'a{padding:10px;margin:0;color:red}.one{color:red}a,p{color:red;padding:0}', - 'a{margin:0}.one{color:red}a,p{color:red;padding:0}' + '.one,a,p{color:red}a{margin:0}a,p{padding:0}' ] }, { advanced: true, aggressiveMerging: true }) ) @@ -165,7 +229,7 @@ vows.describe(SelectorsOptimizer) ], 'non-adjacent with multi selectors': [ 'a{padding:10px;margin:0;color:red}.one{color:red}a,p{color:red;padding:0}', - 'a{padding:10px;margin:0}.one{color:red}a,p{color:red;padding:0}' + '.one,a,p{color:red}a{padding:10px;margin:0}a,p{padding:0}' ] }, { advanced: true, aggressiveMerging: false }) ) diff --git a/test/source-map-test.js b/test/source-map-test.js index 087b2b8a..8e1bc099 100644 --- a/test/source-map-test.js +++ b/test/source-map-test.js @@ -900,4 +900,47 @@ vows.describe('source-map') } } }) + .addBatch({ + 'advanced optimizations': { + 'new property in smart sort': { + 'topic': new CleanCSS({ sourceMap: true }).minify('a{color:#000}div{color:red}.one{display:block}.two{display:inline;color:red}'), + 'should have 5 mappings': function (minified) { + assert.lengthOf(minified.sourceMap._mappings._array, 9); + }, + 'should have a merged ".two" mapping': function (minified) { + var mapping = { + generatedLine: 1, + generatedColumn: 13, + originalLine: 1, + originalColumn: 46, + source: '__stdin__.css', + name: null + }; + assert.deepEqual(minified.sourceMap._mappings._array[2], mapping); + }, + 'should have a merged "div" mapping': function (minified) { + var mapping = { + generatedLine: 1, + generatedColumn: 18, + originalLine: 1, + originalColumn: 13, + source: '__stdin__.css', + name: null + }; + assert.deepEqual(minified.sourceMap._mappings._array[3], mapping); + }, + 'should have a merged "color:red" mapping': function (minified) { + var mapping = { + generatedLine: 1, + generatedColumn: 22, + originalLine: 1, + originalColumn: 66, + source: '__stdin__.css', + name: null + }; + assert.deepEqual(minified.sourceMap._mappings._array[4], mapping); + } + } + } + }) .export(module);