colorgy_style 0.0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.editorconfig +41 -0
- data/.gitignore +13 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/Gemfile +10 -0
- data/README.md +36 -0
- data/Rakefile +11 -0
- data/assets/fonts/colorgy/.keep +0 -0
- data/assets/images/colorgy/.keep +0 -0
- data/assets/javascripts/colorgy.js +1 -0
- data/assets/javascripts/colorgy/main.js +7 -0
- data/assets/javascripts/colorgy/modernizr.js +7 -0
- data/assets/javascripts/colorgy/modernizr/classifier.coffee +14 -0
- data/assets/javascripts/vendor/es5-shim.js +1432 -0
- data/assets/javascripts/vendor/modernizr.js +1406 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/a-download.js +8 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/audio-audiodata-api.js +4 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/audio-webaudio-api.js +4 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/battery-api.js +8 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/battery-level.js +11 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/blob-constructor.js +10 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/canvas-todataurl-type.js +28 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/contenteditable.js +9 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/contentsecuritypolicy.js +10 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/contextmenu.js +11 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/cookies.js +15 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/cors.js +3 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/css-backgroundposition-shorthand.js +19 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/css-backgroundposition-xy.js +15 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/css-backgroundrepeat.js +31 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/css-backgroundsizecover.js +10 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/css-boxsizing.js +9 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/css-calc.js +12 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/css-cubicbezierrange.js +8 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/css-displayrunin.js +18 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/css-displaytable.js +27 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/css-filters.js +7 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/css-hyphens.js +205 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/css-lastchild.js +11 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/css-mask.js +12 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/css-mediaqueries.js +3 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/css-objectfit.js +6 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/css-overflow-scrolling.js +9 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/css-pointerevents.js +25 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/css-positionsticky.js +13 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/css-regions.js +55 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/css-remunit.js +19 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/css-resize.js +8 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/css-scrollbars.js +19 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/css-shapes.js +4 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/css-subpixelfont.js +23 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/css-supports.js +6 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/css-userselect.js +10 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/css-vhunit.js +14 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/css-vmaxunit.js +14 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/css-vminunit.js +14 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/css-vwunit.js +14 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/custom-protocol-handler.js +10 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/dart.js +6 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/dataview-api.js +4 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/dom-classlist.js +4 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/dom-createElement-attrs.js +11 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/dom-dataset.js +9 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/dom-microdata.js +4 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/elem-datalist.js +12 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/elem-details.js +25 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/elem-output.js +4 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/elem-progress-meter.js +11 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/elem-ruby.js +53 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/elem-time.js +4 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/elem-track.js +11 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/emoji.js +11 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/es5-strictmode.js +7 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/event-deviceorientation-motion.js +11 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/exif-orientation.js +32 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/file-api.js +12 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/file-filesystem.js +9 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/forms-fileinput.js +13 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/forms-formattribute.js +29 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/forms-inputnumber-l10n.js +32 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/forms-placeholder.js +10 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/forms-speechinput.js +19 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/forms-validation.js +62 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/fullscreen-api.js +10 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/gamepad.js +12 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/getusermedia.js +5 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/ie8compat.js +12 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/iframe-sandbox.js +5 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/iframe-seamless.js +5 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/iframe-srcdoc.js +5 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/img-apng.js +26 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/img-webp.js +20 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/json.js +7 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/lists-reversed.js +6 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/mathml.js +23 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/network-connection.js +22 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/network-eventsource.js +5 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/network-xhr2.js +13 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/notification.js +10 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/performance.js +5 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/pointerlock-api.js +4 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/quota-management-api.js +11 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/requestanimationframe.js +7 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/script-async.js +3 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/script-defer.js +3 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/style-scoped.js +6 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/svg-filters.js +13 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/unicode.js +32 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/url-data-uri.js +26 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/userdata.js +7 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/vibration.js +4 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/web-intents.js +6 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/webgl-extensions.js +42 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/websockets-binary.js +20 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/window-framed.js +8 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/workers-blobworkers.js +66 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/workers-dataworkers.js +34 -0
- data/assets/javascripts/vendor/modernizr/feature-detects/workers-sharedworkers.js +3 -0
- data/assets/stylesheets/colorgy.scss +1 -0
- data/assets/stylesheets/colorgy/components/.keep +0 -0
- data/assets/stylesheets/colorgy/components/_button.scss +18 -0
- data/assets/stylesheets/colorgy/core/_base.scss +12 -0
- data/assets/stylesheets/colorgy/core/_config.scss +8 -0
- data/assets/stylesheets/colorgy/core/_fonts.scss +8 -0
- data/assets/stylesheets/colorgy/core/_grid.scss +8 -0
- data/assets/stylesheets/colorgy/core/_helpers.scss +44 -0
- data/assets/stylesheets/colorgy/layouts/.keep +0 -0
- data/assets/stylesheets/colorgy/main.scss +63 -0
- data/assets/stylesheets/colorgy/structures/.keep +0 -0
- data/bin/console +14 -0
- data/bin/server +3 -0
- data/bin/setup +7 -0
- data/colorgy_style.gemspec +52 -0
- data/config.rb +63 -0
- data/lib/colorgy_style.rb +74 -0
- data/lib/colorgy_style/rails.rb +13 -0
- data/lib/colorgy_style/version.rb +3 -0
- data/styleguide/index.html.haml +7 -0
- data/styleguide/javascripts/body.js +5 -0
- data/styleguide/javascripts/head.js +2 -0
- data/styleguide/javascripts/styleguide/kss.js +40 -0
- data/styleguide/javascripts/styleguide/prism.js +6 -0
- data/styleguide/layouts/default.erb +5 -0
- data/styleguide/layouts/layout.erb +20 -0
- data/styleguide/styleblocks/.keep +0 -0
- data/styleguide/styleblocks/_button.html.erb +23 -0
- data/styleguide/stylesheets/all.css +4 -0
- data/styleguide/stylesheets/styleguide/_prism.css +107 -0
- data/styleguide/stylesheets/styleguide/styles.scss +97 -0
- metadata +402 -0
@@ -0,0 +1,11 @@
|
|
1
|
+
// last-child pseudo selector
|
2
|
+
// https://github.com/Modernizr/Modernizr/pull/304
|
3
|
+
|
4
|
+
|
5
|
+
Modernizr.addTest('lastchild', function(){
|
6
|
+
|
7
|
+
return Modernizr.testStyles("#modernizr div {width:100px} #modernizr :last-child{width:200px;display:block}", function (elem) {
|
8
|
+
return elem.lastChild.offsetWidth > elem.firstChild.offsetWidth;
|
9
|
+
}, 2);
|
10
|
+
|
11
|
+
});
|
@@ -0,0 +1,12 @@
|
|
1
|
+
// this tests passes for webkit's proprietary `-webkit-mask` feature
|
2
|
+
// www.webkit.org/blog/181/css-masks/
|
3
|
+
// developer.apple.com/library/safari/#documentation/InternetWeb/Conceptual/SafariVisualEffectsProgGuide/Masks/Masks.html
|
4
|
+
|
5
|
+
// it does not pass mozilla's implementation of `mask` for SVG
|
6
|
+
|
7
|
+
// developer.mozilla.org/en/CSS/mask
|
8
|
+
// developer.mozilla.org/En/Applying_SVG_effects_to_HTML_content
|
9
|
+
|
10
|
+
// Can combine with clippaths for awesomeness: http://generic.cx/for/webkit/test.html
|
11
|
+
|
12
|
+
Modernizr.addTest('cssmask', Modernizr.testAllProps('maskRepeat'));
|
@@ -0,0 +1,25 @@
|
|
1
|
+
|
2
|
+
// developer.mozilla.org/en/CSS/pointer-events
|
3
|
+
|
4
|
+
// Test and project pages:
|
5
|
+
// ausi.github.com/Feature-detection-technique-for-pointer-events/
|
6
|
+
// github.com/ausi/Feature-detection-technique-for-pointer-events/wiki
|
7
|
+
// github.com/Modernizr/Modernizr/issues/80
|
8
|
+
|
9
|
+
|
10
|
+
Modernizr.addTest('pointerevents', function(){
|
11
|
+
var element = document.createElement('x'),
|
12
|
+
documentElement = document.documentElement,
|
13
|
+
getComputedStyle = window.getComputedStyle,
|
14
|
+
supports;
|
15
|
+
if(!('pointerEvents' in element.style)){
|
16
|
+
return false;
|
17
|
+
}
|
18
|
+
element.style.pointerEvents = 'auto';
|
19
|
+
element.style.pointerEvents = 'x';
|
20
|
+
documentElement.appendChild(element);
|
21
|
+
supports = getComputedStyle &&
|
22
|
+
getComputedStyle(element, '').pointerEvents === 'auto';
|
23
|
+
documentElement.removeChild(element);
|
24
|
+
return !!supports;
|
25
|
+
});
|
@@ -0,0 +1,13 @@
|
|
1
|
+
// Sticky positioning - constrains an element to be positioned inside the
|
2
|
+
// intersection of its container box, and the viewport.
|
3
|
+
Modernizr.addTest('csspositionsticky', function () {
|
4
|
+
|
5
|
+
var prop = 'position:';
|
6
|
+
var value = 'sticky';
|
7
|
+
var el = document.createElement('modernizr');
|
8
|
+
var mStyle = el.style;
|
9
|
+
|
10
|
+
mStyle.cssText = prop + Modernizr._prefixes.join(value + ';' + prop).slice(0, -prop.length);
|
11
|
+
|
12
|
+
return mStyle.position.indexOf(value) !== -1;
|
13
|
+
});
|
@@ -0,0 +1,55 @@
|
|
1
|
+
// CSS Regions
|
2
|
+
// http://www.w3.org/TR/css3-regions/
|
3
|
+
// By: Mihai Balan
|
4
|
+
|
5
|
+
// We start with a CSS parser test then we check page geometry to see if it's affected by regions
|
6
|
+
// Later we might be able to retire the second part, as WebKit builds with the false positives die out
|
7
|
+
|
8
|
+
Modernizr.addTest('regions', function() {
|
9
|
+
|
10
|
+
/* Get the 'flowFrom' property name available in the browser. Either default or vendor prefixed.
|
11
|
+
If the property name can't be found we'll get Boolean 'false' and fail quickly */
|
12
|
+
var flowFromProperty = Modernizr.prefixed("flowFrom"),
|
13
|
+
flowIntoProperty = Modernizr.prefixed("flowInto");
|
14
|
+
|
15
|
+
if (!flowFromProperty || !flowIntoProperty){
|
16
|
+
return false;
|
17
|
+
}
|
18
|
+
|
19
|
+
/* If CSS parsing is there, try to determine if regions actually work. */
|
20
|
+
var container = document.createElement('div'),
|
21
|
+
content = document.createElement('div'),
|
22
|
+
region = document.createElement('div'),
|
23
|
+
|
24
|
+
/* we create a random, unlikely to be generated flow number to make sure we don't
|
25
|
+
clash with anything more vanilla, like 'flow', or 'article', or 'f1' */
|
26
|
+
flowName = 'modernizr_flow_for_regions_check';
|
27
|
+
|
28
|
+
/* First create a div with two adjacent divs inside it. The first will be the
|
29
|
+
content, the second will be the region. To be able to distinguish between the two,
|
30
|
+
we'll give the region a particular padding */
|
31
|
+
content.innerText = 'M';
|
32
|
+
container.style.cssText = 'top: 150px; left: 150px; padding: 0px;';
|
33
|
+
region.style.cssText = 'width: 50px; height: 50px; padding: 42px;';
|
34
|
+
|
35
|
+
region.style[flowFromProperty] = flowName;
|
36
|
+
container.appendChild(content);
|
37
|
+
container.appendChild(region);
|
38
|
+
document.documentElement.appendChild(container);
|
39
|
+
|
40
|
+
/* Now compute the bounding client rect, before and after attempting to flow the
|
41
|
+
content div in the region div. If regions are enabled, the after bounding rect
|
42
|
+
should reflect the padding of the region div.*/
|
43
|
+
var flowedRect, delta,
|
44
|
+
plainRect = content.getBoundingClientRect();
|
45
|
+
|
46
|
+
|
47
|
+
content.style[flowIntoProperty] = flowName;
|
48
|
+
flowedRect = content.getBoundingClientRect();
|
49
|
+
|
50
|
+
delta = flowedRect.left - plainRect.left;
|
51
|
+
document.documentElement.removeChild(container);
|
52
|
+
content = region = container = undefined;
|
53
|
+
|
54
|
+
return (delta == 42);
|
55
|
+
});
|
@@ -0,0 +1,19 @@
|
|
1
|
+
|
2
|
+
// test by github.com/nsfmc
|
3
|
+
|
4
|
+
// "The 'rem' unit ('root em') is relative to the computed
|
5
|
+
// value of the 'font-size' value of the root element."
|
6
|
+
// http://www.w3.org/TR/css3-values/#relative0
|
7
|
+
// you can test by checking if the prop was ditched
|
8
|
+
|
9
|
+
// http://snook.ca/archives/html_and_css/font-size-with-rem
|
10
|
+
|
11
|
+
Modernizr.addTest('cssremunit', function(){
|
12
|
+
|
13
|
+
var div = document.createElement('div');
|
14
|
+
try {
|
15
|
+
div.style.fontSize = '3rem';
|
16
|
+
} catch(er){}
|
17
|
+
return (/rem/).test(div.style.fontSize);
|
18
|
+
|
19
|
+
});
|
@@ -0,0 +1,19 @@
|
|
1
|
+
// Stylable scrollbars detection
|
2
|
+
Modernizr.addTest('cssscrollbar', function() {
|
3
|
+
|
4
|
+
var bool,
|
5
|
+
|
6
|
+
styles = "#modernizr{overflow: scroll; width: 40px }#" +
|
7
|
+
Modernizr._prefixes
|
8
|
+
.join("scrollbar{width:0px}"+' #modernizr::')
|
9
|
+
.split('#')
|
10
|
+
.slice(1)
|
11
|
+
.join('#') + "scrollbar{width:0px}";
|
12
|
+
|
13
|
+
Modernizr.testStyles(styles, function(node) {
|
14
|
+
bool = 'scrollWidth' in node && node.scrollWidth == 40;
|
15
|
+
});
|
16
|
+
|
17
|
+
return bool;
|
18
|
+
|
19
|
+
});
|
@@ -0,0 +1,23 @@
|
|
1
|
+
/*
|
2
|
+
* Test for SubPixel Font Rendering
|
3
|
+
* (to infer if GDI or DirectWrite is used on Windows)
|
4
|
+
* Authors: @derSchepp, @gerritvanaaken, @rodneyrehm, @yatil, @ryanseddon
|
5
|
+
* Web: https://github.com/gerritvanaaken/subpixeldetect
|
6
|
+
*/
|
7
|
+
Modernizr.addTest('subpixelfont', function() {
|
8
|
+
var bool,
|
9
|
+
styles = "#modernizr{position: absolute; top: -10em; visibility:hidden; font: normal 10px arial;}#subpixel{float: left; font-size: 33.3333%;}";
|
10
|
+
|
11
|
+
// see https://github.com/Modernizr/Modernizr/blob/master/modernizr.js#L97
|
12
|
+
Modernizr.testStyles(styles, function(elem) {
|
13
|
+
var subpixel = elem.firstChild;
|
14
|
+
|
15
|
+
subpixel.innerHTML = 'This is a text written in Arial';
|
16
|
+
|
17
|
+
bool = window.getComputedStyle ?
|
18
|
+
window.getComputedStyle(subpixel, null).getPropertyValue("width") !== '44px'
|
19
|
+
: false;
|
20
|
+
}, 1, ['subpixel']);
|
21
|
+
|
22
|
+
return bool;
|
23
|
+
});
|
@@ -0,0 +1,6 @@
|
|
1
|
+
// http://dev.w3.org/csswg/css3-conditional/#at-supports
|
2
|
+
// github.com/Modernizr/Modernizr/issues/648
|
3
|
+
// Relies on the fact that a browser vendor should expose the CSSSupportsRule interface
|
4
|
+
// http://dev.w3.org/csswg/css3-conditional/#the-csssupportsrule-interface
|
5
|
+
|
6
|
+
Modernizr.addTest("supports","CSSSupportsRule" in window);
|
@@ -0,0 +1,14 @@
|
|
1
|
+
// https://github.com/Modernizr/Modernizr/issues/572
|
2
|
+
// Similar to http://jsfiddle.net/FWeinb/etnYC/
|
3
|
+
Modernizr.addTest('cssvhunit', function() {
|
4
|
+
var bool;
|
5
|
+
Modernizr.testStyles("#modernizr { height: 50vh; }", function(elem, rule) {
|
6
|
+
var height = parseInt(window.innerHeight/2,10),
|
7
|
+
compStyle = parseInt((window.getComputedStyle ?
|
8
|
+
getComputedStyle(elem, null) :
|
9
|
+
elem.currentStyle)["height"],10);
|
10
|
+
|
11
|
+
bool= (compStyle == height);
|
12
|
+
});
|
13
|
+
return bool;
|
14
|
+
});
|
@@ -0,0 +1,14 @@
|
|
1
|
+
// https://github.com/Modernizr/Modernizr/issues/572
|
2
|
+
// http://jsfiddle.net/glsee/JDsWQ/4/
|
3
|
+
Modernizr.addTest('cssvmaxunit', function(){
|
4
|
+
var bool;
|
5
|
+
Modernizr.testStyles("#modernizr { width: 50vmax; }", function(elem, rule) {
|
6
|
+
var one_vw = window.innerWidth/100,
|
7
|
+
one_vh = window.innerHeight/100,
|
8
|
+
compWidth = parseInt((window.getComputedStyle ?
|
9
|
+
getComputedStyle(elem, null) :
|
10
|
+
elem.currentStyle)['width'],10);
|
11
|
+
bool = ( parseInt(Math.max(one_vw, one_vh)*50,10) == compWidth );
|
12
|
+
});
|
13
|
+
return bool;
|
14
|
+
});
|
@@ -0,0 +1,14 @@
|
|
1
|
+
// https://github.com/Modernizr/Modernizr/issues/572
|
2
|
+
// http://jsfiddle.net/glsee/JRmdq/8/
|
3
|
+
Modernizr.addTest('cssvminunit', function(){
|
4
|
+
var bool;
|
5
|
+
Modernizr.testStyles("#modernizr { width: 50vmin; }", function(elem, rule) {
|
6
|
+
var one_vw = window.innerWidth/100,
|
7
|
+
one_vh = window.innerHeight/100,
|
8
|
+
compWidth = parseInt((window.getComputedStyle ?
|
9
|
+
getComputedStyle(elem, null) :
|
10
|
+
elem.currentStyle)['width'],10);
|
11
|
+
bool = ( parseInt(Math.min(one_vw, one_vh)*50,10) == compWidth );
|
12
|
+
});
|
13
|
+
return bool;
|
14
|
+
});
|
@@ -0,0 +1,14 @@
|
|
1
|
+
// https://github.com/Modernizr/Modernizr/issues/572
|
2
|
+
// http://jsfiddle.net/FWeinb/etnYC/
|
3
|
+
Modernizr.addTest('cssvwunit', function(){
|
4
|
+
var bool;
|
5
|
+
Modernizr.testStyles("#modernizr { width: 50vw; }", function(elem, rule) {
|
6
|
+
var width = parseInt(window.innerWidth/2,10),
|
7
|
+
compStyle = parseInt((window.getComputedStyle ?
|
8
|
+
getComputedStyle(elem, null) :
|
9
|
+
elem.currentStyle)["width"],10);
|
10
|
+
|
11
|
+
bool= (compStyle == width);
|
12
|
+
});
|
13
|
+
return bool;
|
14
|
+
});
|
@@ -0,0 +1,11 @@
|
|
1
|
+
// by james a rosen.
|
2
|
+
// https://github.com/Modernizr/Modernizr/issues/258
|
3
|
+
|
4
|
+
Modernizr.addTest('createelement-attrs', function() {
|
5
|
+
try {
|
6
|
+
return document.createElement("<input name='test' />").getAttribute('name') == 'test';
|
7
|
+
} catch(e) {
|
8
|
+
return false;
|
9
|
+
}
|
10
|
+
});
|
11
|
+
|
@@ -0,0 +1,12 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
// lol. we already have a test for datalist built in! silly you.
|
4
|
+
|
5
|
+
|
6
|
+
// Helpful links while you're here, though..
|
7
|
+
|
8
|
+
// http://css-tricks.com/15346-relevant-dropdowns-polyfill-for-datalist/
|
9
|
+
// http://miketaylr.com/test/datalist.html
|
10
|
+
// http://miketaylr.com/code/datalist.html
|
11
|
+
|
12
|
+
Modernizr.addTest('datalistelem', Modernizr.input.list );
|
@@ -0,0 +1,25 @@
|
|
1
|
+
// By @mathias, based on http://mths.be/axh
|
2
|
+
Modernizr.addTest('details', function() {
|
3
|
+
var doc = document,
|
4
|
+
el = doc.createElement('details'),
|
5
|
+
fake,
|
6
|
+
root,
|
7
|
+
diff;
|
8
|
+
if (!('open' in el)) { // return early if possible; thanks @aFarkas!
|
9
|
+
return false;
|
10
|
+
}
|
11
|
+
root = doc.body || (function() {
|
12
|
+
var de = doc.documentElement;
|
13
|
+
fake = true;
|
14
|
+
return de.insertBefore(doc.createElement('body'), de.firstElementChild || de.firstChild);
|
15
|
+
}());
|
16
|
+
el.innerHTML = '<summary>a</summary>b';
|
17
|
+
el.style.display = 'block';
|
18
|
+
root.appendChild(el);
|
19
|
+
diff = el.offsetHeight;
|
20
|
+
el.open = true;
|
21
|
+
diff = diff != el.offsetHeight;
|
22
|
+
root.removeChild(el);
|
23
|
+
fake && root.parentNode.removeChild(root);
|
24
|
+
return diff;
|
25
|
+
});
|
@@ -0,0 +1,11 @@
|
|
1
|
+
//By Stefan Wallin
|
2
|
+
|
3
|
+
//tests for progressbar-support. All browsers that don't support progressbar returns undefined =)
|
4
|
+
Modernizr.addTest("progressbar",function(){
|
5
|
+
return document.createElement('progress').max !== undefined;
|
6
|
+
});
|
7
|
+
|
8
|
+
//tests for meter-support. All browsers that don't support meters returns undefined =)
|
9
|
+
Modernizr.addTest("meter",function(){
|
10
|
+
return document.createElement('meter').max !== undefined;
|
11
|
+
});
|
@@ -0,0 +1,53 @@
|
|
1
|
+
// Browser support test for the HTML5 <ruby>, <rt> and <rp> elements
|
2
|
+
// http://www.whatwg.org/specs/web-apps/current-work/multipage/text-level-semantics.html#the-ruby-element
|
3
|
+
//
|
4
|
+
// by @alrra
|
5
|
+
|
6
|
+
Modernizr.addTest('ruby', function () {
|
7
|
+
|
8
|
+
var ruby = document.createElement('ruby'),
|
9
|
+
rt = document.createElement('rt'),
|
10
|
+
rp = document.createElement('rp'),
|
11
|
+
docElement = document.documentElement,
|
12
|
+
displayStyleProperty = 'display',
|
13
|
+
fontSizeStyleProperty = 'fontSize'; // 'fontSize' - because it`s only used for IE6 and IE7
|
14
|
+
|
15
|
+
ruby.appendChild(rp);
|
16
|
+
ruby.appendChild(rt);
|
17
|
+
docElement.appendChild(ruby);
|
18
|
+
|
19
|
+
// browsers that support <ruby> hide the <rp> via "display:none"
|
20
|
+
if ( getStyle(rp, displayStyleProperty) == 'none' || // for non-IE browsers
|
21
|
+
// but in IE browsers <rp> has "display:inline" so, the test needs other conditions:
|
22
|
+
getStyle(ruby, displayStyleProperty) == 'ruby' && getStyle(rt, displayStyleProperty) == 'ruby-text' || // for IE8 & IE9
|
23
|
+
getStyle(rp, fontSizeStyleProperty) == '6pt' && getStyle(rt, fontSizeStyleProperty) == '6pt' ) { // for IE6 & IE7
|
24
|
+
|
25
|
+
cleanUp();
|
26
|
+
return true;
|
27
|
+
|
28
|
+
} else {
|
29
|
+
cleanUp();
|
30
|
+
return false;
|
31
|
+
}
|
32
|
+
|
33
|
+
function getStyle( element, styleProperty ) {
|
34
|
+
var result;
|
35
|
+
|
36
|
+
if ( window.getComputedStyle ) { // for non-IE browsers
|
37
|
+
result = document.defaultView.getComputedStyle(element,null).getPropertyValue(styleProperty);
|
38
|
+
} else if ( element.currentStyle ) { // for IE
|
39
|
+
result = element.currentStyle[styleProperty];
|
40
|
+
}
|
41
|
+
|
42
|
+
return result;
|
43
|
+
}
|
44
|
+
|
45
|
+
function cleanUp() {
|
46
|
+
docElement.removeChild(ruby);
|
47
|
+
// the removed child node still exists in memory, so ...
|
48
|
+
ruby = null;
|
49
|
+
rt = null;
|
50
|
+
rp = null;
|
51
|
+
}
|
52
|
+
|
53
|
+
});
|