stylecow-core
Advanced tools
Comparing version 1.0.2 to 1.1.0
@@ -156,2 +156,47 @@ (function (stylecow) { | ||
getSiblings: function (match) { | ||
var parent = this.parent; | ||
var result = new Collection(); | ||
if (!parent) { | ||
return result; | ||
} | ||
for (var i = 0, t = parent.length; i < t; ++i) { | ||
if (parent[i] !== this && parent[i].is(match)) { | ||
result.push(this[i]); | ||
} | ||
}; | ||
return result; | ||
}, | ||
hasSibling: function (match) { | ||
var parent = this.parent; | ||
if (!parent) { | ||
return false; | ||
} | ||
for (var i = 0, t = parent.length; i < t; ++i) { | ||
if (parent[i] !== this && parent[i].is(match)) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
}, | ||
getSibling: function (match) { | ||
var parent = this.parent; | ||
if (parent) { | ||
for (var i = 0, t = parent.length; i < t; ++i) { | ||
if (parent[i] !== this && parent[i].is(match)) { | ||
return parent[i]; | ||
} | ||
} | ||
} | ||
}, | ||
setSource: function (token) { | ||
@@ -158,0 +203,0 @@ this.data.line = token.currToken[1]; |
@@ -63,6 +63,10 @@ (function (stylecow) { | ||
//browser compatibility | ||
if (!needFix(support, task.forBrowsersLowerThan)) { | ||
if (!needFix(support, task, 'forBrowsersLowerThan')) { | ||
continue; | ||
} | ||
if (!needFix(support, task, 'forBrowsersUpperOrEqualTo')) { | ||
continue; | ||
} | ||
//Sort by position (after|before) | ||
@@ -101,15 +105,27 @@ tasks[task.position] = tasks[task.position] || {}; | ||
//check the browser support of a task | ||
function needFix (minSupport, disablePlugin) { | ||
if (!disablePlugin || !minSupport) { | ||
function needFix (stylecowSupport, task, method) { | ||
var taskSupport = task[method]; | ||
if (!taskSupport || !stylecowSupport) { | ||
return true; | ||
} | ||
for (var browser in disablePlugin) { | ||
if (minSupport[browser] === false) { | ||
for (var browser in taskSupport) { | ||
if (stylecowSupport[browser] === false) { | ||
continue; | ||
} | ||
if (disablePlugin[browser] === false || minSupport[browser] < disablePlugin[browser]) { | ||
if (method === 'forBrowsersLowerThan' && (taskSupport[browser] === false || stylecowSupport[browser] < taskSupport[browser])) { | ||
return true; | ||
} | ||
if (method === 'forBrowsersUpperOrEqualTo') { | ||
if (taskSupport[browser] === false) { | ||
return false; | ||
} | ||
if (stylecowSupport[browser] >= taskSupport[browser]) { | ||
return true; | ||
} | ||
} | ||
} | ||
@@ -116,0 +132,0 @@ |
{ | ||
"name": "stylecow-core", | ||
"description": "Stylecow core library", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"author": "Oscar Otero <oom@oscarotero.com>", | ||
@@ -6,0 +6,0 @@ "homepage": "https://github.com/stylecow/stylecow-core", |
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
56010693
290820