Comparing version 2.1.0 to 2.1.1
@@ -0,1 +1,4 @@ | ||
## 2.1.1 - 28 Dec. 2016 | ||
* Fixes a bug in self closing ignore directive (Fixes [#88](https://github.com/MohammadYounes/rtlcss/issues/88)). | ||
## 2.1.0 - 30 Nov. 2016 | ||
@@ -2,0 +5,0 @@ * Support CSS `background-position` edge offsets. |
@@ -11,3 +11,11 @@ 'use strict' | ||
'expect': { 'atrule': true, 'comment': true, 'decl': true, 'rule': true }, | ||
'endNode': null, | ||
'begin': function (node, metadata, context) { | ||
// find the ending node in case of self closing directive | ||
if (!this.endNode && metadata.begin && metadata.end) { | ||
while (node && node.nodes) { | ||
node = node.nodes[node.nodes.length - 1] | ||
} | ||
this.endNode = node | ||
} | ||
var prevent = true | ||
@@ -20,4 +28,8 @@ if (node.type === 'comment' && (node.text === '!rtl:end:ignore' || node.text === 'rtl:end:ignore')) { | ||
'end': function (node, metadata, context) { | ||
// end if triggered by comment or last declaration is reached | ||
if (node.type === 'comment' || node.type === 'decl' && context.util.isLastOfType(node)) { | ||
// end if: | ||
// 1. block directive and the node is comment | ||
// 2. self closing directive and node is endNode | ||
if (metadata.begin !== metadata.end && node.type === 'comment' || metadata.begin && metadata.end && node === this.endNode) { | ||
// clear ending node | ||
this.endNode = null | ||
return true | ||
@@ -24,0 +36,0 @@ } |
{ | ||
"author": "Mohammad Younes", | ||
"name": "rtlcss", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "Framework for transforming cascading style sheets (CSS) from left-to-right (LTR) to right-to-left (RTL)", | ||
@@ -6,0 +6,0 @@ "homepage": "http://rtlcss.com/", |
@@ -314,3 +314,96 @@ module.exports = [ | ||
'options': { 'autoRename': true } | ||
}, | ||
{ | ||
'should': 'Should ignore the target node (decl)', | ||
'expected': ` | ||
.code { | ||
direction:ltr; | ||
text-align:left; | ||
float: right; | ||
text-align: left; | ||
} | ||
`, | ||
'input': ` | ||
.code { | ||
/*rtl:ignore*/ | ||
direction:ltr; | ||
/*rtl:ignore*/ | ||
text-align:left; | ||
/*rtl:ignore*/ | ||
float: right; | ||
/*rtl:ignore*/ | ||
text-align: left; | ||
} | ||
`, | ||
'reversable': false | ||
}, | ||
{ | ||
'should': 'Should ignore the target node (rule)', | ||
'expected': ` | ||
.example-1 { | ||
text-align:right; | ||
left:10px; | ||
} | ||
.example-2 { | ||
left:10px; | ||
text-align:right; | ||
} | ||
.example-3 { | ||
right:10px; | ||
text-align:left; | ||
} | ||
`, | ||
'input': ` | ||
/*rtl:ignore*/ | ||
.example-1 { | ||
text-align:right; | ||
left:10px; | ||
} | ||
/*rtl:ignore*/ | ||
.example-2 { | ||
left:10px; | ||
text-align:right; | ||
} | ||
.example-3 { | ||
left:10px; | ||
text-align:right; | ||
} | ||
`, | ||
'reversable': false | ||
}, | ||
{ | ||
'should': 'Should ignore the target node (atrule)', | ||
'expected': ` | ||
@media screen and (max-width: 568px) { | ||
.example { | ||
left:10px; | ||
text-align:right; | ||
} | ||
} | ||
@media screen and (max-width: 568px) { | ||
.example { | ||
right:10px; | ||
text-align:left; | ||
} | ||
} | ||
`, | ||
'input': ` | ||
/*rtl:ignore*/ | ||
@media screen and (max-width: 568px) { | ||
.example { | ||
left:10px; | ||
text-align:right; | ||
} | ||
} | ||
@media screen and (max-width: 568px) { | ||
.example { | ||
left:10px; | ||
text-align:right; | ||
} | ||
} | ||
`, | ||
'reversable': false | ||
} | ||
] |
Sorry, the diff of this file is not supported yet
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
134281
3143