postcss-zindex
Advanced tools
Comparing version 2.0.1 to 2.1.0
@@ -0,1 +1,6 @@ | ||
# 2.1.0 | ||
* Now aborts early when encountering negative indices, making the transform | ||
safer overall. | ||
# 2.0.1 | ||
@@ -2,0 +7,0 @@ |
10
index.js
@@ -9,4 +9,14 @@ 'use strict'; | ||
var nodes = []; | ||
var abort = false; | ||
// First pass; cache all z indexes | ||
css.walkDecls('z-index', function (decl) { | ||
if (abort) { | ||
return; | ||
} | ||
// Check that no negative values exist. Rebasing is only | ||
// safe if all indices are positive numbers. | ||
if (decl.value[0] === '-') { | ||
abort = true; | ||
return; | ||
} | ||
nodes.push(decl); | ||
@@ -13,0 +23,0 @@ cache.addValue(decl.value); |
{ | ||
"name": "postcss-zindex", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"description": "Reduce z-index values with PostCSS.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -50,5 +50,7 @@ # [postcss][postcss]-zindex [![Build Status](https://travis-ci.org/ben-eb/postcss-zindex.svg?branch=master)][ci] [![NPM version](https://badge.fury.io/js/postcss-zindex.svg)][npm] [![Dependency Status](https://gemnasium.com/ben-eb/postcss-zindex.svg)][deps] | ||
Note that this module does not attempt to normalize relative z-index values, | ||
such as `-1`. Be careful with using this module alongside JavaScript injected | ||
CSS; ideally you should have already extracted all of your stacking context | ||
into CSS. | ||
such as `-1`; indeed, it will abort immediately when encountering these values | ||
as it cannot be sure that rebasing mixed positive & negative values will keep | ||
the stacking context intact. Be careful with using this module alongside | ||
JavaScript injected CSS; ideally you should have already extracted all of your | ||
stacking context into CSS. | ||
@@ -55,0 +57,0 @@ ## Usage |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7008
77
74