Skip to content

Commit 341782c

Browse files
author
Marc J. Schmidt
committed
Merge branch 'master' of github.com:marcj/css-element-queries
2 parents 1bf024b + e8a4ac0 commit 341782c

File tree

5 files changed

+89
-7
lines changed

5 files changed

+89
-7
lines changed

LICENSE

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2013 Marc J. Schmidt
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in
11+
all copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
THE SOFTWARE.

README.md

100755100644
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,34 @@ Issues
6767
6868
6969
Event-Based resize detection inspired by [backalleycoder.com](http://www.backalleycoder.com/2013/03/18/cross-browser-event-based-element-resize-detection/) <3
70+
71+
72+
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/marcj/css-element-queries/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
73+
74+
75+
License
76+
-------
77+
This code is copyright 2013 Marc J. Schmidt and is licensed under the MIT license. See the `LICENSE` file for the full text.
78+
79+
80+
ElementQueries.convertToPx covered by the following license:
81+
82+
> Copyright (c) 2013 Rob Brackett
83+
>
84+
> Permission is hereby granted, free of charge, to any person obtaining a copy of
85+
> this software and associated documentation files (the "Software"), to deal in
86+
> the Software without restriction, including without limitation the rights to
87+
> use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
88+
> of the Software, and to permit persons to whom the Software is furnished to do
89+
> so, subject to the following conditions:
90+
>
91+
> The above copyright notice and this permission notice shall be included in all
92+
> copies or substantial portions of the Software.
93+
>
94+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
95+
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
96+
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
97+
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
98+
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
99+
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
100+
> SOFTWARE.

bower.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "css-element-queries",
3+
"version": "0.0.1",
4+
"main": [
5+
"./src/js/ElementQueries.js",
6+
"./src/js/ResizeSensor.js"
7+
],
8+
"ignore": [
9+
"**/.*",
10+
"_*",
11+
"Gruntfile.js",
12+
"composer.json",
13+
"package.json",
14+
"*.html"
15+
],
16+
"dependencies": {
17+
}
18+
}
19+

src/ElementQueries.js

100644100755
Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* Copyright 2013 Marc J. Schmidt. See the LICENSE file at the top-level
3+
* directory of this distribution and at
4+
* https://github.com/marcj/css-element-queries/blob/master/LICENSE.
5+
*/
16
;
27
(function() {
38
/**
@@ -21,7 +26,7 @@
2126

2227
/**
2328
*
24-
* @copyright https://github.com/Mr0grog/element-query
29+
* @copyright https://github.com/Mr0grog/element-query/blob/master/LICENSE
2530
*
2631
* @param element
2732
* @param value
@@ -143,9 +148,10 @@
143148
* @param {String} value
144149
*/
145150
function queueQuery(selector, mode, property, value) {
146-
var query = document.querySelectorAll;
147-
if ('undefined' !== typeof $$) query = $$;
148-
if ('undefined' !== typeof jQuery) query = jQuery;
151+
var query;
152+
if (document.querySelectorAll) query = document.querySelectorAll.bind(document);
153+
if (!query && 'undefined' !== typeof $$) query = $$;
154+
if (!query && 'undefined' !== typeof jQuery) query = jQuery;
149155

150156
if (!query) {
151157
throw 'No document.querySelectorAll, jQuery or Mootools\'s $$ found.';
@@ -193,7 +199,9 @@
193199
for (var i = 0, j = rules.length; i < j; i++) {
194200
if (1 === rules[i].type) {
195201
selector = rules[i].selectorText || rules[i].cssText;
196-
if (-1 !== selector.indexOf('min-width') || -1 !== selector.indexOf('max-width')) {
202+
if (-1 !== selector.indexOf('min-height') || -1 !== selector.indexOf('max-height')) {
203+
extractQuery(selector);
204+
}else if(-1 !== selector.indexOf('min-width') || -1 !== selector.indexOf('max-width')) {
197205
extractQuery(selector);
198206
}
199207
} else if (4 === rules[i].type) {

src/ResizeSensor.js

100644100755
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* Copyright 2013 Marc J. Schmidt. See the LICENSE file at the top-level
3+
* directory of this distribution and at
4+
* https://github.com/marcj/css-element-queries/blob/master/LICENSE.
5+
*/
16
;
27
(function() {
38

@@ -114,8 +119,8 @@
114119
element.style.position = 'relative';
115120
}
116121

117-
var x = 0,
118-
y = 0,
122+
var x = -1,
123+
y = -1,
119124
firstStyle = element.resizeSensor.firstElementChild.firstChild.style,
120125
lastStyle = element.resizeSensor.lastElementChild.firstChild.style;
121126

0 commit comments

Comments
 (0)