colorgy_style 0.0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (151) hide show
  1. checksums.yaml +7 -0
  2. data/.editorconfig +41 -0
  3. data/.gitignore +13 -0
  4. data/.rspec +2 -0
  5. data/.travis.yml +4 -0
  6. data/Gemfile +10 -0
  7. data/README.md +36 -0
  8. data/Rakefile +11 -0
  9. data/assets/fonts/colorgy/.keep +0 -0
  10. data/assets/images/colorgy/.keep +0 -0
  11. data/assets/javascripts/colorgy.js +1 -0
  12. data/assets/javascripts/colorgy/main.js +7 -0
  13. data/assets/javascripts/colorgy/modernizr.js +7 -0
  14. data/assets/javascripts/colorgy/modernizr/classifier.coffee +14 -0
  15. data/assets/javascripts/vendor/es5-shim.js +1432 -0
  16. data/assets/javascripts/vendor/modernizr.js +1406 -0
  17. data/assets/javascripts/vendor/modernizr/feature-detects/a-download.js +8 -0
  18. data/assets/javascripts/vendor/modernizr/feature-detects/audio-audiodata-api.js +4 -0
  19. data/assets/javascripts/vendor/modernizr/feature-detects/audio-webaudio-api.js +4 -0
  20. data/assets/javascripts/vendor/modernizr/feature-detects/battery-api.js +8 -0
  21. data/assets/javascripts/vendor/modernizr/feature-detects/battery-level.js +11 -0
  22. data/assets/javascripts/vendor/modernizr/feature-detects/blob-constructor.js +10 -0
  23. data/assets/javascripts/vendor/modernizr/feature-detects/canvas-todataurl-type.js +28 -0
  24. data/assets/javascripts/vendor/modernizr/feature-detects/contenteditable.js +9 -0
  25. data/assets/javascripts/vendor/modernizr/feature-detects/contentsecuritypolicy.js +10 -0
  26. data/assets/javascripts/vendor/modernizr/feature-detects/contextmenu.js +11 -0
  27. data/assets/javascripts/vendor/modernizr/feature-detects/cookies.js +15 -0
  28. data/assets/javascripts/vendor/modernizr/feature-detects/cors.js +3 -0
  29. data/assets/javascripts/vendor/modernizr/feature-detects/css-backgroundposition-shorthand.js +19 -0
  30. data/assets/javascripts/vendor/modernizr/feature-detects/css-backgroundposition-xy.js +15 -0
  31. data/assets/javascripts/vendor/modernizr/feature-detects/css-backgroundrepeat.js +31 -0
  32. data/assets/javascripts/vendor/modernizr/feature-detects/css-backgroundsizecover.js +10 -0
  33. data/assets/javascripts/vendor/modernizr/feature-detects/css-boxsizing.js +9 -0
  34. data/assets/javascripts/vendor/modernizr/feature-detects/css-calc.js +12 -0
  35. data/assets/javascripts/vendor/modernizr/feature-detects/css-cubicbezierrange.js +8 -0
  36. data/assets/javascripts/vendor/modernizr/feature-detects/css-displayrunin.js +18 -0
  37. data/assets/javascripts/vendor/modernizr/feature-detects/css-displaytable.js +27 -0
  38. data/assets/javascripts/vendor/modernizr/feature-detects/css-filters.js +7 -0
  39. data/assets/javascripts/vendor/modernizr/feature-detects/css-hyphens.js +205 -0
  40. data/assets/javascripts/vendor/modernizr/feature-detects/css-lastchild.js +11 -0
  41. data/assets/javascripts/vendor/modernizr/feature-detects/css-mask.js +12 -0
  42. data/assets/javascripts/vendor/modernizr/feature-detects/css-mediaqueries.js +3 -0
  43. data/assets/javascripts/vendor/modernizr/feature-detects/css-objectfit.js +6 -0
  44. data/assets/javascripts/vendor/modernizr/feature-detects/css-overflow-scrolling.js +9 -0
  45. data/assets/javascripts/vendor/modernizr/feature-detects/css-pointerevents.js +25 -0
  46. data/assets/javascripts/vendor/modernizr/feature-detects/css-positionsticky.js +13 -0
  47. data/assets/javascripts/vendor/modernizr/feature-detects/css-regions.js +55 -0
  48. data/assets/javascripts/vendor/modernizr/feature-detects/css-remunit.js +19 -0
  49. data/assets/javascripts/vendor/modernizr/feature-detects/css-resize.js +8 -0
  50. data/assets/javascripts/vendor/modernizr/feature-detects/css-scrollbars.js +19 -0
  51. data/assets/javascripts/vendor/modernizr/feature-detects/css-shapes.js +4 -0
  52. data/assets/javascripts/vendor/modernizr/feature-detects/css-subpixelfont.js +23 -0
  53. data/assets/javascripts/vendor/modernizr/feature-detects/css-supports.js +6 -0
  54. data/assets/javascripts/vendor/modernizr/feature-detects/css-userselect.js +10 -0
  55. data/assets/javascripts/vendor/modernizr/feature-detects/css-vhunit.js +14 -0
  56. data/assets/javascripts/vendor/modernizr/feature-detects/css-vmaxunit.js +14 -0
  57. data/assets/javascripts/vendor/modernizr/feature-detects/css-vminunit.js +14 -0
  58. data/assets/javascripts/vendor/modernizr/feature-detects/css-vwunit.js +14 -0
  59. data/assets/javascripts/vendor/modernizr/feature-detects/custom-protocol-handler.js +10 -0
  60. data/assets/javascripts/vendor/modernizr/feature-detects/dart.js +6 -0
  61. data/assets/javascripts/vendor/modernizr/feature-detects/dataview-api.js +4 -0
  62. data/assets/javascripts/vendor/modernizr/feature-detects/dom-classlist.js +4 -0
  63. data/assets/javascripts/vendor/modernizr/feature-detects/dom-createElement-attrs.js +11 -0
  64. data/assets/javascripts/vendor/modernizr/feature-detects/dom-dataset.js +9 -0
  65. data/assets/javascripts/vendor/modernizr/feature-detects/dom-microdata.js +4 -0
  66. data/assets/javascripts/vendor/modernizr/feature-detects/elem-datalist.js +12 -0
  67. data/assets/javascripts/vendor/modernizr/feature-detects/elem-details.js +25 -0
  68. data/assets/javascripts/vendor/modernizr/feature-detects/elem-output.js +4 -0
  69. data/assets/javascripts/vendor/modernizr/feature-detects/elem-progress-meter.js +11 -0
  70. data/assets/javascripts/vendor/modernizr/feature-detects/elem-ruby.js +53 -0
  71. data/assets/javascripts/vendor/modernizr/feature-detects/elem-time.js +4 -0
  72. data/assets/javascripts/vendor/modernizr/feature-detects/elem-track.js +11 -0
  73. data/assets/javascripts/vendor/modernizr/feature-detects/emoji.js +11 -0
  74. data/assets/javascripts/vendor/modernizr/feature-detects/es5-strictmode.js +7 -0
  75. data/assets/javascripts/vendor/modernizr/feature-detects/event-deviceorientation-motion.js +11 -0
  76. data/assets/javascripts/vendor/modernizr/feature-detects/exif-orientation.js +32 -0
  77. data/assets/javascripts/vendor/modernizr/feature-detects/file-api.js +12 -0
  78. data/assets/javascripts/vendor/modernizr/feature-detects/file-filesystem.js +9 -0
  79. data/assets/javascripts/vendor/modernizr/feature-detects/forms-fileinput.js +13 -0
  80. data/assets/javascripts/vendor/modernizr/feature-detects/forms-formattribute.js +29 -0
  81. data/assets/javascripts/vendor/modernizr/feature-detects/forms-inputnumber-l10n.js +32 -0
  82. data/assets/javascripts/vendor/modernizr/feature-detects/forms-placeholder.js +10 -0
  83. data/assets/javascripts/vendor/modernizr/feature-detects/forms-speechinput.js +19 -0
  84. data/assets/javascripts/vendor/modernizr/feature-detects/forms-validation.js +62 -0
  85. data/assets/javascripts/vendor/modernizr/feature-detects/fullscreen-api.js +10 -0
  86. data/assets/javascripts/vendor/modernizr/feature-detects/gamepad.js +12 -0
  87. data/assets/javascripts/vendor/modernizr/feature-detects/getusermedia.js +5 -0
  88. data/assets/javascripts/vendor/modernizr/feature-detects/ie8compat.js +12 -0
  89. data/assets/javascripts/vendor/modernizr/feature-detects/iframe-sandbox.js +5 -0
  90. data/assets/javascripts/vendor/modernizr/feature-detects/iframe-seamless.js +5 -0
  91. data/assets/javascripts/vendor/modernizr/feature-detects/iframe-srcdoc.js +5 -0
  92. data/assets/javascripts/vendor/modernizr/feature-detects/img-apng.js +26 -0
  93. data/assets/javascripts/vendor/modernizr/feature-detects/img-webp.js +20 -0
  94. data/assets/javascripts/vendor/modernizr/feature-detects/json.js +7 -0
  95. data/assets/javascripts/vendor/modernizr/feature-detects/lists-reversed.js +6 -0
  96. data/assets/javascripts/vendor/modernizr/feature-detects/mathml.js +23 -0
  97. data/assets/javascripts/vendor/modernizr/feature-detects/network-connection.js +22 -0
  98. data/assets/javascripts/vendor/modernizr/feature-detects/network-eventsource.js +5 -0
  99. data/assets/javascripts/vendor/modernizr/feature-detects/network-xhr2.js +13 -0
  100. data/assets/javascripts/vendor/modernizr/feature-detects/notification.js +10 -0
  101. data/assets/javascripts/vendor/modernizr/feature-detects/performance.js +5 -0
  102. data/assets/javascripts/vendor/modernizr/feature-detects/pointerlock-api.js +4 -0
  103. data/assets/javascripts/vendor/modernizr/feature-detects/quota-management-api.js +11 -0
  104. data/assets/javascripts/vendor/modernizr/feature-detects/requestanimationframe.js +7 -0
  105. data/assets/javascripts/vendor/modernizr/feature-detects/script-async.js +3 -0
  106. data/assets/javascripts/vendor/modernizr/feature-detects/script-defer.js +3 -0
  107. data/assets/javascripts/vendor/modernizr/feature-detects/style-scoped.js +6 -0
  108. data/assets/javascripts/vendor/modernizr/feature-detects/svg-filters.js +13 -0
  109. data/assets/javascripts/vendor/modernizr/feature-detects/unicode.js +32 -0
  110. data/assets/javascripts/vendor/modernizr/feature-detects/url-data-uri.js +26 -0
  111. data/assets/javascripts/vendor/modernizr/feature-detects/userdata.js +7 -0
  112. data/assets/javascripts/vendor/modernizr/feature-detects/vibration.js +4 -0
  113. data/assets/javascripts/vendor/modernizr/feature-detects/web-intents.js +6 -0
  114. data/assets/javascripts/vendor/modernizr/feature-detects/webgl-extensions.js +42 -0
  115. data/assets/javascripts/vendor/modernizr/feature-detects/websockets-binary.js +20 -0
  116. data/assets/javascripts/vendor/modernizr/feature-detects/window-framed.js +8 -0
  117. data/assets/javascripts/vendor/modernizr/feature-detects/workers-blobworkers.js +66 -0
  118. data/assets/javascripts/vendor/modernizr/feature-detects/workers-dataworkers.js +34 -0
  119. data/assets/javascripts/vendor/modernizr/feature-detects/workers-sharedworkers.js +3 -0
  120. data/assets/stylesheets/colorgy.scss +1 -0
  121. data/assets/stylesheets/colorgy/components/.keep +0 -0
  122. data/assets/stylesheets/colorgy/components/_button.scss +18 -0
  123. data/assets/stylesheets/colorgy/core/_base.scss +12 -0
  124. data/assets/stylesheets/colorgy/core/_config.scss +8 -0
  125. data/assets/stylesheets/colorgy/core/_fonts.scss +8 -0
  126. data/assets/stylesheets/colorgy/core/_grid.scss +8 -0
  127. data/assets/stylesheets/colorgy/core/_helpers.scss +44 -0
  128. data/assets/stylesheets/colorgy/layouts/.keep +0 -0
  129. data/assets/stylesheets/colorgy/main.scss +63 -0
  130. data/assets/stylesheets/colorgy/structures/.keep +0 -0
  131. data/bin/console +14 -0
  132. data/bin/server +3 -0
  133. data/bin/setup +7 -0
  134. data/colorgy_style.gemspec +52 -0
  135. data/config.rb +63 -0
  136. data/lib/colorgy_style.rb +74 -0
  137. data/lib/colorgy_style/rails.rb +13 -0
  138. data/lib/colorgy_style/version.rb +3 -0
  139. data/styleguide/index.html.haml +7 -0
  140. data/styleguide/javascripts/body.js +5 -0
  141. data/styleguide/javascripts/head.js +2 -0
  142. data/styleguide/javascripts/styleguide/kss.js +40 -0
  143. data/styleguide/javascripts/styleguide/prism.js +6 -0
  144. data/styleguide/layouts/default.erb +5 -0
  145. data/styleguide/layouts/layout.erb +20 -0
  146. data/styleguide/styleblocks/.keep +0 -0
  147. data/styleguide/styleblocks/_button.html.erb +23 -0
  148. data/styleguide/stylesheets/all.css +4 -0
  149. data/styleguide/stylesheets/styleguide/_prism.css +107 -0
  150. data/styleguide/stylesheets/styleguide/styles.scss +97 -0
  151. metadata +402 -0
@@ -0,0 +1,8 @@
1
+
2
+ // a[download] attribute
3
+ // When used on an <a>, this attribute signifies that the resource it
4
+ // points to should be downloaded by the browser rather than navigating to it.
5
+ // http://developers.whatwg.org/links.html#downloading-resources
6
+ // By Addy Osmani
7
+
8
+ Modernizr.addTest('adownload', 'download' in document.createElement('a'));
@@ -0,0 +1,4 @@
1
+ // Mozilla Audio Data API
2
+ // https://wiki.mozilla.org/Audio_Data_API
3
+ // by Addy Osmani
4
+ Modernizr.addTest('audiodata', !!(window.Audio));
@@ -0,0 +1,4 @@
1
+ // Web Audio API
2
+ // https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html
3
+ // By Addy Osmani
4
+ Modernizr.addTest('webaudio', !!(window.webkitAudioContext || window.AudioContext));
@@ -0,0 +1,8 @@
1
+
2
+ // Battery API
3
+ // https://developer.mozilla.org/en/DOM/window.navigator.mozBattery
4
+ // By: Paul Sayre
5
+
6
+ Modernizr.addTest('battery',
7
+ !!Modernizr.prefixed('battery', navigator)
8
+ );
@@ -0,0 +1,11 @@
1
+
2
+ // Low Battery Level
3
+ // Enable a developer to remove CPU intensive CSS/JS when battery is low
4
+ // developer.mozilla.org/en/DOM/window.navigator.mozBattery
5
+ // By: Paul Sayre
6
+
7
+ Modernizr.addTest('lowbattery', function () {
8
+ var minLevel = 0.20,
9
+ battery = Modernizr.prefixed('battery', navigator);
10
+ return !!(battery && !battery.charging && battery.level <= minLevel);
11
+ });
@@ -0,0 +1,10 @@
1
+ // Blob constructor
2
+ // http://dev.w3.org/2006/webapi/FileAPI/#constructorBlob
3
+
4
+ Modernizr.addTest('blobconstructor', function () {
5
+ try {
6
+ return !!new Blob();
7
+ } catch (e) {
8
+ return false;
9
+ }
10
+ });
@@ -0,0 +1,28 @@
1
+ // canvas.toDataURL type support
2
+ // http://www.w3.org/TR/html5/the-canvas-element.html#dom-canvas-todataurl
3
+
4
+ // This test is asynchronous. Watch out.
5
+
6
+ (function () {
7
+
8
+ if (!Modernizr.canvas) {
9
+ return false;
10
+ }
11
+
12
+ var image = new Image(),
13
+ canvas = document.createElement('canvas'),
14
+ ctx = canvas.getContext('2d');
15
+
16
+ image.onload = function() {
17
+ ctx.drawImage(image, 0, 0);
18
+
19
+ Modernizr.addTest('todataurljpeg', function() {
20
+ return canvas.toDataURL('image/jpeg').indexOf('data:image/jpeg') === 0;
21
+ });
22
+ Modernizr.addTest('todataurlwebp', function() {
23
+ return canvas.toDataURL('image/webp').indexOf('data:image/webp') === 0;
24
+ });
25
+ };
26
+
27
+ image.src = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==';
28
+ }());
@@ -0,0 +1,9 @@
1
+ // contentEditable
2
+ // http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#contenteditable
3
+
4
+ // this is known to false positive in some mobile browsers
5
+ // here is a whitelist of verified working browsers:
6
+ // https://github.com/NielsLeenheer/html5test/blob/549f6eac866aa861d9649a0707ff2c0157895706/scripts/engine.js#L2083
7
+
8
+ Modernizr.addTest('contenteditable',
9
+ 'contentEditable' in document.documentElement);
@@ -0,0 +1,10 @@
1
+ // Test for (experimental) Content Security Policy 1.1 support.
2
+ //
3
+ // This feature is still quite experimental, but is available now in Chrome 22.
4
+ // If the `SecurityPolicy` property is available, you can be sure the browser
5
+ // supports CSP. If it's not available, the browser still might support an
6
+ // earlier version of the CSP spec.
7
+ //
8
+ // Editor's Draft: https://dvcs.w3.org/hg/content-security-policy/raw-file/tip/csp-specification.dev.html
9
+
10
+ Modernizr.addTest('contentsecuritypolicy', ('securityPolicy' in document || 'SecurityPolicy' in document));
@@ -0,0 +1,11 @@
1
+ // http://www.w3.org/TR/html5/interactive-elements.html#context-menus
2
+ // Demo at http://thewebrocks.com/demos/context-menu/
3
+ Modernizr.addTest(
4
+ 'contextmenu',
5
+ ('contextMenu' in document.documentElement && 'HTMLMenuItemElement' in window)
6
+ );
7
+
8
+
9
+
10
+
11
+
@@ -0,0 +1,15 @@
1
+
2
+ // by tauren
3
+ // https://github.com/Modernizr/Modernizr/issues/191
4
+
5
+ Modernizr.addTest('cookies', function () {
6
+ // Quick test if browser has cookieEnabled host property
7
+ if (navigator.cookieEnabled) return true;
8
+ // Create cookie
9
+ document.cookie = "cookietest=1";
10
+ var ret = document.cookie.indexOf("cookietest=") != -1;
11
+ // Delete cookie
12
+ document.cookie = "cookietest=1; expires=Thu, 01-Jan-1970 00:00:01 GMT";
13
+ return ret;
14
+ });
15
+
@@ -0,0 +1,3 @@
1
+ // cors
2
+ // By Theodoor van Donge
3
+ Modernizr.addTest('cors', !!(window.XMLHttpRequest && 'withCredentials' in new XMLHttpRequest()));
@@ -0,0 +1,19 @@
1
+ /*
2
+ https://developer.mozilla.org/en/CSS/background-position
3
+ http://www.w3.org/TR/css3-background/#background-position
4
+
5
+ Example: http://jsfiddle.net/Blink/bBXvt/
6
+ */
7
+
8
+ (function() {
9
+
10
+ var elem = document.createElement('a'),
11
+ eStyle = elem.style,
12
+ val = "right 10px bottom 10px";
13
+
14
+ Modernizr.addTest('bgpositionshorthand', function(){
15
+ eStyle.cssText = "background-position: " + val + ";";
16
+ return (eStyle.backgroundPosition === val);
17
+ });
18
+
19
+ }());
@@ -0,0 +1,15 @@
1
+ /*
2
+ Allan Lei https://github.com/allanlei
3
+
4
+ Check adapted from https://github.com/brandonaaron/jquery-cssHooks/blob/master/bgpos.js
5
+
6
+ Test: http://jsfiddle.net/allanlei/R8AYS/
7
+ */
8
+ Modernizr.addTest('bgpositionxy', function() {
9
+ return Modernizr.testStyles('#modernizr {background-position: 3px 5px;}', function(elem) {
10
+ var cssStyleDeclaration = window.getComputedStyle ? getComputedStyle(elem, null) : elem.currentStyle;
11
+ var xSupport = (cssStyleDeclaration.backgroundPositionX == '3px') || (cssStyleDeclaration['background-position-x'] == '3px');
12
+ var ySupport = (cssStyleDeclaration.backgroundPositionY == '5px') || (cssStyleDeclaration['background-position-y'] == '5px');
13
+ return xSupport && ySupport;
14
+ });
15
+ });
@@ -0,0 +1,31 @@
1
+ // developer.mozilla.org/en/CSS/background-repeat
2
+
3
+ // test page: jsbin.com/uzesun/
4
+ // http://jsfiddle.net/ryanseddon/yMLTQ/6/
5
+
6
+ (function(){
7
+
8
+
9
+ function getBgRepeatValue(elem){
10
+ return (window.getComputedStyle ?
11
+ getComputedStyle(elem, null).getPropertyValue('background') :
12
+ elem.currentStyle['background']);
13
+ }
14
+
15
+
16
+ Modernizr.testStyles(' #modernizr { background-repeat: round; } ', function(elem, rule){
17
+
18
+ Modernizr.addTest('bgrepeatround', getBgRepeatValue(elem) == 'round');
19
+
20
+ });
21
+
22
+
23
+
24
+ Modernizr.testStyles(' #modernizr { background-repeat: space; } ', function(elem, rule){
25
+
26
+ Modernizr.addTest('bgrepeatspace', getBgRepeatValue(elem) == 'space');
27
+
28
+ });
29
+
30
+
31
+ })();
@@ -0,0 +1,10 @@
1
+
2
+ // developer.mozilla.org/en/CSS/background-size
3
+
4
+ Modernizr.testStyles( '#modernizr{background-size:cover}', function( elem ) {
5
+ var style = window.getComputedStyle ?
6
+ window.getComputedStyle( elem, null )
7
+ : elem.currentStyle;
8
+
9
+ Modernizr.addTest( 'bgsizecover', style.backgroundSize == 'cover' );
10
+ });
@@ -0,0 +1,9 @@
1
+
2
+ // developer.mozilla.org/en/CSS/box-sizing
3
+ // github.com/Modernizr/Modernizr/issues/248
4
+
5
+ Modernizr.addTest("boxsizing",function(){
6
+ return Modernizr.testAllProps("boxSizing") && (document.documentMode === undefined || document.documentMode > 7);
7
+ });
8
+
9
+
@@ -0,0 +1,12 @@
1
+ // Method of allowing calculated values for length units, i.e. width: calc(100%-3em) http://caniuse.com/#search=calc
2
+ // By @calvein
3
+
4
+ Modernizr.addTest('csscalc', function() {
5
+ var prop = 'width:';
6
+ var value = 'calc(10px);';
7
+ var el = document.createElement('div');
8
+
9
+ el.style.cssText = prop + Modernizr._prefixes.join(value + prop);
10
+
11
+ return !!el.style.length;
12
+ });
@@ -0,0 +1,8 @@
1
+ // cubic-bezier values can't be > 1 for Webkit until bug #45761 (https://bugs.webkit.org/show_bug.cgi?id=45761) is fixed
2
+ // By @calvein
3
+
4
+ Modernizr.addTest('cubicbezierrange', function() {
5
+ var el = document.createElement('div');
6
+ el.style.cssText = Modernizr._prefixes.join('transition-timing-function' + ':cubic-bezier(1,0,0,1.1); ');
7
+ return !!el.style.length;
8
+ });
@@ -0,0 +1,18 @@
1
+
2
+ // by alanhogan
3
+
4
+ // https://github.com/Modernizr/Modernizr/issues/198
5
+ // http://css-tricks.com/596-run-in/
6
+
7
+
8
+
9
+ Modernizr.testStyles(' #modernizr { display: run-in; } ', function(elem, rule){
10
+
11
+ var ret = (window.getComputedStyle ?
12
+ getComputedStyle(elem, null).getPropertyValue('display') :
13
+ elem.currentStyle['display']);
14
+
15
+ Modernizr.addTest('display-runin', ret == 'run-in');
16
+
17
+ });
18
+
@@ -0,0 +1,27 @@
1
+ // display: table and table-cell test. (both are tested under one name "table-cell" )
2
+ // By @scottjehl
3
+
4
+ // all additional table display values are here: http://pastebin.com/Gk9PeVaQ though Scott has seen some IE false positives with that sort of weak detection.
5
+ // more testing neccessary perhaps.
6
+
7
+ Modernizr.addTest( "display-table",function(){
8
+
9
+ var doc = window.document,
10
+ docElem = doc.documentElement,
11
+ parent = doc.createElement( "div" ),
12
+ child = doc.createElement( "div" ),
13
+ childb = doc.createElement( "div" ),
14
+ ret;
15
+
16
+ parent.style.cssText = "display: table";
17
+ child.style.cssText = childb.style.cssText = "display: table-cell; padding: 10px";
18
+
19
+ parent.appendChild( child );
20
+ parent.appendChild( childb );
21
+ docElem.insertBefore( parent, docElem.firstChild );
22
+
23
+ ret = child.offsetLeft < childb.offsetLeft;
24
+ docElem.removeChild(parent);
25
+ return ret;
26
+ });
27
+
@@ -0,0 +1,7 @@
1
+ // https://github.com/Modernizr/Modernizr/issues/615
2
+ // documentMode is needed for false positives in oldIE, please see issue above
3
+ Modernizr.addTest('cssfilters', function() {
4
+ var el = document.createElement('div');
5
+ el.style.cssText = Modernizr._prefixes.join('filter' + ':blur(2px); ');
6
+ return !!el.style.length && ((document.documentMode === undefined || document.documentMode > 9));
7
+ });
@@ -0,0 +1,205 @@
1
+ /* see http://davidnewton.ca/the-current-state-of-hyphenation-on-the-web
2
+ http://davidnewton.ca/demos/hyphenation/test.html
3
+
4
+
5
+ There are three tests:
6
+ 1. csshyphens - tests hyphens:auto actually adds hyphens to text
7
+ 2. softhyphens - tests that &shy; does its job
8
+ 3. softhyphensfind - tests that in-browser Find functionality still works correctly with &shy;
9
+
10
+ These tests currently require document.body to be present
11
+
12
+ Hyphenation is language specific, sometimes.
13
+ See for more details: http://code.google.com/p/hyphenator/source/diff?spec=svn975&r=975&format=side&path=/trunk/Hyphenator.js#sc_svn975_313
14
+
15
+ If loading Hyphenator.js via Modernizr.load, be cautious of issue 158: http://code.google.com/p/hyphenator/issues/detail?id=158
16
+
17
+ More details at https://github.com/Modernizr/Modernizr/issues/312
18
+
19
+ */
20
+
21
+ (function() {
22
+
23
+ if (!document.body){
24
+ window.console && console.warn('document.body doesn\'t exist. Modernizr hyphens test needs it.');
25
+ return;
26
+ }
27
+
28
+ // functional test of adding hyphens:auto
29
+ function test_hyphens_css() {
30
+ try {
31
+ /* create a div container and a span within that
32
+ * these have to be appended to document.body, otherwise some browsers can give false negative */
33
+ var div = document.createElement('div'),
34
+ span = document.createElement('span'),
35
+ divStyle = div.style,
36
+ spanHeight = 0,
37
+ spanWidth = 0,
38
+ result = false,
39
+ firstChild = document.body.firstElementChild || document.body.firstChild;
40
+
41
+ div.appendChild(span);
42
+ span.innerHTML = 'Bacon ipsum dolor sit amet jerky velit in culpa hamburger et. Laborum dolor proident, enim dolore duis commodo et strip steak. Salami anim et, veniam consectetur dolore qui tenderloin jowl velit sirloin. Et ad culpa, fatback cillum jowl ball tip ham hock nulla short ribs pariatur aute. Pig pancetta ham bresaola, ut boudin nostrud commodo flank esse cow tongue culpa. Pork belly bresaola enim pig, ea consectetur nisi. Fugiat officia turkey, ea cow jowl pariatur ullamco proident do laborum velit sausage. Magna biltong sint tri-tip commodo sed bacon, esse proident aliquip. Ullamco ham sint fugiat, velit in enim sed mollit nulla cow ut adipisicing nostrud consectetur. Proident dolore beef ribs, laborum nostrud meatball ea laboris rump cupidatat labore culpa. Shankle minim beef, velit sint cupidatat fugiat tenderloin pig et ball tip. Ut cow fatback salami, bacon ball tip et in shank strip steak bresaola. In ut pork belly sed mollit tri-tip magna culpa veniam, short ribs qui in andouille ham consequat. Dolore bacon t-bone, velit short ribs enim strip steak nulla. Voluptate labore ut, biltong swine irure jerky. Cupidatat excepteur aliquip salami dolore. Ball tip strip steak in pork dolor. Ad in esse biltong. Dolore tenderloin exercitation ad pork loin t-bone, dolore in chicken ball tip qui pig. Ut culpa tongue, sint ribeye dolore ex shank voluptate hamburger. Jowl et tempor, boudin pork chop labore ham hock drumstick consectetur tri-tip elit swine meatball chicken ground round. Proident shankle mollit dolore. Shoulder ut duis t-bone quis reprehenderit. Meatloaf dolore minim strip steak, laboris ea aute bacon beef ribs elit shank in veniam drumstick qui. Ex laboris meatball cow tongue pork belly. Ea ball tip reprehenderit pig, sed fatback boudin dolore flank aliquip laboris eu quis. Beef ribs duis beef, cow corned beef adipisicing commodo nisi deserunt exercitation. Cillum dolor t-bone spare ribs, ham hock est sirloin. Brisket irure meatloaf in, boudin pork belly sirloin ball tip. Sirloin sint irure nisi nostrud aliqua. Nostrud nulla aute, enim officia culpa ham hock. Aliqua reprehenderit dolore sunt nostrud sausage, ea boudin pork loin ut t-bone ham tempor. Tri-tip et pancetta drumstick laborum. Ham hock magna do nostrud in proident. Ex ground round fatback, venison non ribeye in.';
43
+
44
+ document.body.insertBefore(div, firstChild);
45
+
46
+ /* get size of unhyphenated text */
47
+ divStyle.cssText = 'position:absolute;top:0;left:0;width:5em;text-align:justify;text-justification:newspaper;';
48
+ spanHeight = span.offsetHeight;
49
+ spanWidth = span.offsetWidth;
50
+
51
+ /* compare size with hyphenated text */
52
+ divStyle.cssText = 'position:absolute;top:0;left:0;width:5em;text-align:justify;'+
53
+ 'text-justification:newspaper;'+
54
+ Modernizr._prefixes.join('hyphens:auto; ');
55
+
56
+ result = (span.offsetHeight != spanHeight || span.offsetWidth != spanWidth);
57
+
58
+ /* results and cleanup */
59
+ document.body.removeChild(div);
60
+ div.removeChild(span);
61
+
62
+ return result;
63
+ } catch(e) {
64
+ return false;
65
+ }
66
+ }
67
+
68
+ // for the softhyphens test
69
+ function test_hyphens(delimiter, testWidth) {
70
+ try {
71
+ /* create a div container and a span within that
72
+ * these have to be appended to document.body, otherwise some browsers can give false negative */
73
+ var div = document.createElement('div'),
74
+ span = document.createElement('span'),
75
+ divStyle = div.style,
76
+ spanSize = 0,
77
+ result = false,
78
+ result1 = false,
79
+ result2 = false,
80
+ firstChild = document.body.firstElementChild || document.body.firstChild;
81
+
82
+ divStyle.cssText = 'position:absolute;top:0;left:0;overflow:visible;width:1.25em;';
83
+ div.appendChild(span);
84
+ document.body.insertBefore(div, firstChild);
85
+
86
+
87
+ /* get height of unwrapped text */
88
+ span.innerHTML = 'mm';
89
+ spanSize = span.offsetHeight;
90
+
91
+ /* compare height w/ delimiter, to see if it wraps to new line */
92
+ span.innerHTML = 'm' + delimiter + 'm';
93
+ result1 = (span.offsetHeight > spanSize);
94
+
95
+ /* if we're testing the width too (i.e. for soft-hyphen, not zws),
96
+ * this is because tested Blackberry devices will wrap the text but not display the hyphen */
97
+ if (testWidth) {
98
+ /* get width of wrapped, non-hyphenated text */
99
+ span.innerHTML = 'm<br />m';
100
+ spanSize = span.offsetWidth;
101
+
102
+ /* compare width w/ wrapped w/ delimiter to see if hyphen is present */
103
+ span.innerHTML = 'm' + delimiter + 'm';
104
+ result2 = (span.offsetWidth > spanSize);
105
+ } else {
106
+ result2 = true;
107
+ }
108
+
109
+ /* results and cleanup */
110
+ if (result1 === true && result2 === true) { result = true; }
111
+ document.body.removeChild(div);
112
+ div.removeChild(span);
113
+
114
+ return result;
115
+ } catch(e) {
116
+ return false;
117
+ }
118
+ }
119
+
120
+ // testing if in-browser Find functionality will work on hyphenated text
121
+ function test_hyphens_find(delimiter) {
122
+ try {
123
+ /* create a dummy input for resetting selection location, and a div container
124
+ * these have to be appended to document.body, otherwise some browsers can give false negative
125
+ * div container gets the doubled testword, separated by the delimiter
126
+ * Note: giving a width to div gives false positive in iOS Safari */
127
+ var dummy = document.createElement('input'),
128
+ div = document.createElement('div'),
129
+ testword = 'lebowski',
130
+ result = false,
131
+ textrange,
132
+ firstChild = document.body.firstElementChild || document.body.firstChild;
133
+
134
+ div.innerHTML = testword + delimiter + testword;
135
+
136
+ document.body.insertBefore(div, firstChild);
137
+ document.body.insertBefore(dummy, div);
138
+
139
+
140
+ /* reset the selection to the dummy input element, i.e. BEFORE the div container
141
+ * stackoverflow.com/questions/499126/jquery-set-cursor-position-in-text-area */
142
+ if (dummy.setSelectionRange) {
143
+ dummy.focus();
144
+ dummy.setSelectionRange(0,0);
145
+ } else if (dummy.createTextRange) {
146
+ textrange = dummy.createTextRange();
147
+ textrange.collapse(true);
148
+ textrange.moveEnd('character', 0);
149
+ textrange.moveStart('character', 0);
150
+ textrange.select();
151
+ }
152
+
153
+ /* try to find the doubled testword, without the delimiter */
154
+ if (window.find) {
155
+ result = window.find(testword + testword);
156
+ } else {
157
+ try {
158
+ textrange = window.self.document.body.createTextRange();
159
+ result = textrange.findText(testword + testword);
160
+ } catch(e) {
161
+ result = false;
162
+ }
163
+ }
164
+
165
+ document.body.removeChild(div);
166
+ document.body.removeChild(dummy);
167
+
168
+ return result;
169
+ } catch(e) {
170
+ return false;
171
+ }
172
+ }
173
+
174
+ Modernizr.addTest("csshyphens", function() {
175
+
176
+ if (!Modernizr.testAllProps('hyphens')) return false;
177
+
178
+ /* Chrome lies about its hyphens support so we need a more robust test
179
+ crbug.com/107111
180
+ */
181
+ try {
182
+ return test_hyphens_css();
183
+ } catch(e) {
184
+ return false;
185
+ }
186
+ });
187
+
188
+ Modernizr.addTest("softhyphens", function() {
189
+ try {
190
+ // use numeric entity instead of &shy; in case it's XHTML
191
+ return test_hyphens('&#173;', true) && test_hyphens('&#8203;', false);
192
+ } catch(e) {
193
+ return false;
194
+ }
195
+ });
196
+
197
+ Modernizr.addTest("softhyphensfind", function() {
198
+ try {
199
+ return test_hyphens_find('&#173;') && test_hyphens_find('&#8203;');
200
+ } catch(e) {
201
+ return false;
202
+ }
203
+ });
204
+
205
+ })();