eqcss
Advanced tools
Comparing version 1.8.0 to 1.9.0
/* | ||
# EQCSS IE8 Polyfills | ||
## version 1.8.0 | ||
## version 1.9.0 | ||
@@ -6,0 +6,0 @@ This file contains optional polyfills to provide: |
// EQCSS / Tommy Hodgins, Maxime Euzière / MIT license | ||
// version 1.8.0 | ||
// version 1.9.0 | ||
(function(g,d){function h(f){var c=d[f];d[f]=function(f){return a(c(f))}}function k(a,c,e){return(e=this).attachEvent("on"+a,function(a){a=a||g.event;a.preventDefault=a.preventDefault||function(){a.returnValue=!1};a.stopPropagation=a.stopPropagation||function(){a.cancelBubble=!0};try{c.call(e,a)}catch(l){}})}function a(a,c){if(c=a.length)for(;c--;)a[c].addEventListener=k;else a.addEventListener=k;return a}g.addEventListener||(a([d,g]),"Element"in g?g.Element.prototype.addEventListener=k:(d.attachEvent("onreadystatechange", | ||
@@ -4,0 +4,0 @@ function(){a(d.all)}),h("getElementsByTagName"),h("getElementById"),h("createElement"),a(d.all)))})(window,document); |
102
EQCSS.js
/* | ||
# EQCSS | ||
## version 1.8.0 | ||
## version 1.9.0 | ||
@@ -45,3 +45,3 @@ A JavaScript plugin to read EQCSS syntax to provide: | ||
data: [], | ||
version: '1.8.0' | ||
version: '1.9.0' | ||
} | ||
@@ -123,2 +123,3 @@ | ||
} | ||
// Retrieve all link tags | ||
@@ -239,13 +240,13 @@ var link = document.getElementsByTagName('link') | ||
EQCSS.register = function(queries) { | ||
EQCSS.register = function(queries) { | ||
if (Object.prototype.toString.call(queries) === '[object Object]') { | ||
if (Object.prototype.toString.call(queries) === '[object Object]') { | ||
EQCSS.data.push(queries) | ||
EQCSS.data.push(queries) | ||
EQCSS.apply() | ||
EQCSS.apply() | ||
} | ||
} | ||
if (Object.prototype.toString.call(queries) === '[object Array]') { | ||
if (Object.prototype.toString.call(queries) === '[object Array]') { | ||
@@ -260,5 +261,5 @@ for (var i=0; i<queries.length; i++) { | ||
} | ||
} | ||
} | ||
} | ||
@@ -271,9 +272,9 @@ | ||
EQCSS.process = function(code) { | ||
EQCSS.process = function(code) { | ||
var queries = EQCSS.parse(code) | ||
var queries = EQCSS.parse(code) | ||
return EQCSS.register(queries) | ||
return EQCSS.register(queries) | ||
} | ||
} | ||
@@ -935,2 +936,62 @@ | ||
// Characters | ||
case 'characters': | ||
// form inputs | ||
if (elements[j].value) { | ||
if (elements[j].value.length !== final_value) { | ||
test = false | ||
break test_conditions | ||
} | ||
} | ||
// blocks | ||
else { | ||
if (elements[j].textContent.length !== final_value) { | ||
test = false | ||
break test_conditions | ||
} | ||
} | ||
break | ||
// Characters | ||
case 'characters': | ||
// form inputs | ||
if (elements[j].value) { | ||
l(elements[j].value.length) | ||
if (!(elements[j].value.length === final_value)) { | ||
test = false | ||
break test_conditions | ||
} | ||
} | ||
// blocks | ||
else { | ||
if (!(elements[j].textContent.length === final_value)) { | ||
test = false | ||
break test_conditions | ||
} | ||
} | ||
break | ||
// Max-characters | ||
@@ -977,2 +1038,14 @@ case 'max-characters': | ||
// Children | ||
case 'children': | ||
if (elements[j].children.length !== final_value) { | ||
test = false | ||
break test_conditions | ||
} | ||
break | ||
// Max-children | ||
@@ -1464,3 +1537,2 @@ case 'max-children': | ||
// Debug: here's a shortcut for console.log | ||
@@ -1467,0 +1539,0 @@ function l(a) { console.log(a) } |
// EQCSS / Tommy Hodgins, Maxime Euzière / MIT license | ||
// version 1.8.0 | ||
(function(root,factory){if(typeof define==="function"&&define.amd)define([],factory);else if(typeof module==="object"&&module.exports)module.exports=factory();else root.EQCSS=factory()})(this,function(){var EQCSS={data:[],version:"1.8.0"};EQCSS.load=function(){var styles=document.getElementsByTagName("style");for(var i=0;i<styles.length;i++)if(styles[i].namespaceURI!=="http://www.w3.org/2000/svg")if(styles[i].getAttribute("data-eqcss-read")===null){styles[i].setAttribute("data-eqcss-read","true"); | ||
// version 1.9.0 | ||
(function(root,factory){if(typeof define==="function"&&define.amd)define([],factory);else if(typeof module==="object"&&module.exports)module.exports=factory();else root.EQCSS=factory()})(this,function(){var EQCSS={data:[],version:"1.9.0"};EQCSS.load=function(){var styles=document.getElementsByTagName("style");for(var i=0;i<styles.length;i++)if(styles[i].namespaceURI!=="http://www.w3.org/2000/svg")if(styles[i].getAttribute("data-eqcss-read")===null){styles[i].setAttribute("data-eqcss-read","true"); | ||
EQCSS.process(styles[i].innerHTML)}var script=document.getElementsByTagName("script");for(i=0;i<script.length;i++)if(script[i].getAttribute("data-eqcss-read")===null&&script[i].type==="text/eqcss"){if(script[i].src)(function(){var xhr=new XMLHttpRequest;xhr.open("GET",script[i].src,true);xhr.send(null);xhr.onreadystatechange=function(){EQCSS.process(xhr.responseText)}})();else EQCSS.process(script[i].innerHTML);script[i].setAttribute("data-eqcss-read","true")}var link=document.getElementsByTagName("link"); | ||
@@ -25,4 +25,5 @@ for(i=0;i<link.length;i++)if(link[i].getAttribute("data-eqcss-read")===null&&link[i].rel==="stylesheet"){if(link[i].href)(function(){var xhr=new XMLHttpRequest;xhr.open("GET",link[i].href,true);xhr.send(null);xhr.onreadystatechange=function(){EQCSS.process(xhr.responseText)}})();link[i].setAttribute("data-eqcss-read","true")}};EQCSS.parse=function(code){var parsed_queries=new Array;code=code||"";code=code.replace(/\s+/g," ");code=code.replace(/\/\*[\w\W]*?\*\//g,"");code=code.replace(/@element/g, | ||
else element.addEventListener("scroll",function(){EQCSS.throttle();element.hasScrollListener=true});if(recomputed===true||EQCSS.data[i].conditions[k].unit==="px"){if(!(element_scroll<=final_value)){test=false;break test_conditions}}else if(EQCSS.data[i].conditions[k].unit==="%"){element_scroll_size=elements[j].scrollHeight;element_size;if(elements[j]===document.documentElement||elements[j]===document.body)element_size=window.innerHeight;else element_size=parseInt(computed_style.getPropertyValue("height")); | ||
if(!(element_scroll/(element_scroll_size-element_size)*100<=final_value)){test=false;break test_conditions}}break;case "min-characters":if(elements[j].value){if(!(elements[j].value.length>=final_value)){test=false;break test_conditions}}else if(!(elements[j].textContent.length>=final_value)){test=false;break test_conditions}break;case "max-characters":if(elements[j].value){if(!(elements[j].value.length<=final_value)){test=false;break test_conditions}}else if(!(elements[j].textContent.length<=final_value)){test= | ||
false;break test_conditions}break;case "min-children":if(!(elements[j].children.length>=final_value)){test=false;break test_conditions}break;case "max-children":if(!(elements[j].children.length<=final_value)){test=false;break test_conditions}break;case "min-lines":element_height=parseInt(computed_style.getPropertyValue("height"))-parseInt(computed_style.getPropertyValue("border-top-width"))-parseInt(computed_style.getPropertyValue("border-bottom-width"))-parseInt(computed_style.getPropertyValue("padding-top"))- | ||
if(!(element_scroll/(element_scroll_size-element_size)*100<=final_value)){test=false;break test_conditions}}break;case "min-characters":if(elements[j].value){if(!(elements[j].value.length>=final_value)){test=false;break test_conditions}}else if(!(elements[j].textContent.length>=final_value)){test=false;break test_conditions}break;case "characters":if(elements[j].value){if(elements[j].value.length!==final_value){test=false;break test_conditions}}else if(elements[j].textContent.length!==final_value){test= | ||
false;break test_conditions}break;case "characters":if(elements[j].value){l(elements[j].value.length);if(!(elements[j].value.length===final_value)){test=false;break test_conditions}}else if(!(elements[j].textContent.length===final_value)){test=false;break test_conditions}break;case "max-characters":if(elements[j].value){if(!(elements[j].value.length<=final_value)){test=false;break test_conditions}}else if(!(elements[j].textContent.length<=final_value)){test=false;break test_conditions}break;case "min-children":if(!(elements[j].children.length>= | ||
final_value)){test=false;break test_conditions}break;case "children":if(elements[j].children.length!==final_value){test=false;break test_conditions}break;case "max-children":if(!(elements[j].children.length<=final_value)){test=false;break test_conditions}break;case "min-lines":element_height=parseInt(computed_style.getPropertyValue("height"))-parseInt(computed_style.getPropertyValue("border-top-width"))-parseInt(computed_style.getPropertyValue("border-bottom-width"))-parseInt(computed_style.getPropertyValue("padding-top"))- | ||
parseInt(computed_style.getPropertyValue("padding-bottom"));element_line_height=computed_style.getPropertyValue("line-height");if(element_line_height==="normal"){var element_font_size=parseInt(computed_style.getPropertyValue("font-size"));element_line_height=element_font_size*1.125}else element_line_height=parseInt(element_line_height);if(!(element_height/element_line_height>=final_value)){test=false;break test_conditions}break;case "max-lines":element_height=parseInt(computed_style.getPropertyValue("height"))- | ||
@@ -29,0 +30,0 @@ parseInt(computed_style.getPropertyValue("border-top-width"))-parseInt(computed_style.getPropertyValue("border-bottom-width"))-parseInt(computed_style.getPropertyValue("padding-top"))-parseInt(computed_style.getPropertyValue("padding-bottom"));element_line_height=computed_style.getPropertyValue("line-height");if(element_line_height==="normal"){element_font_size=parseInt(computed_style.getPropertyValue("font-size"));element_line_height=element_font_size*1.125}else element_line_height=parseInt(element_line_height); |
{ | ||
"name": "eqcss", | ||
"filename": "EQCSS.js", | ||
"version": "1.8.0", | ||
"version": "1.9.0", | ||
"description": "EQCSS is a CSS reprocessor that introduces Element Queries, Scoped CSS, selectors for parent, next, and previous elements to all browsers IE8 and up", | ||
@@ -6,0 +6,0 @@ "homepage": "http://elementqueries.com", |
@@ -53,7 +53,7 @@ ![](http://i.imgur.com/OUQzoiA.png) | ||
``` | ||
https://cdnjs.cloudflare.com/ajax/libs/eqcss/1.8.0/EQCSS-polyfills.min.js | ||
https://cdnjs.cloudflare.com/ajax/libs/eqcss/1.9.0/EQCSS-polyfills.min.js | ||
``` | ||
``` | ||
https://cdnjs.cloudflare.com/ajax/libs/eqcss/1.8.0/EQCSS.min.js | ||
https://cdnjs.cloudflare.com/ajax/libs/eqcss/1.9.0/EQCSS.min.js | ||
``` | ||
@@ -169,3 +169,3 @@ | ||
- [Date Demo](http://elementqueries.com/demos/date.html) | ||
- [Zastrow-style Element Query Demo Demo](http://elementqueries.com/demos/element-query-demo.html) | ||
- [Zastrow-style Element Query Demo](http://elementqueries.com/demos/element-query-demo.html) | ||
- [Flyout Demo](http://elementqueries.com/demos/flyout.html) | ||
@@ -172,0 +172,0 @@ - [Headline Demo](http://elementqueries.com/demos/headline.html) |
84637
1214