rack-caniuse 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (143) hide show
  1. data/README.md +19 -12
  2. data/caniuse/features-json/apng.json +158 -0
  3. data/caniuse/features-json/audio-api.json +146 -0
  4. data/caniuse/features-json/audio.json +167 -0
  5. data/caniuse/features-json/background-img-opts.json +155 -0
  6. data/caniuse/features-json/blobbuilder.json +146 -0
  7. data/caniuse/features-json/bloburls.json +142 -0
  8. data/caniuse/features-json/border-image.json +142 -0
  9. data/caniuse/features-json/border-radius.json +162 -0
  10. data/caniuse/features-json/calc.json +146 -0
  11. data/caniuse/features-json/canvas-text.json +147 -0
  12. data/caniuse/features-json/canvas.json +161 -0
  13. data/caniuse/features-json/classlist.json +147 -0
  14. data/caniuse/features-json/contenteditable.json +155 -0
  15. data/caniuse/features-json/contentsecuritypolicy.json +144 -0
  16. data/caniuse/features-json/cors.json +156 -0
  17. data/caniuse/features-json/css-animation.json +148 -0
  18. data/caniuse/features-json/css-boxshadow.json +156 -0
  19. data/caniuse/features-json/css-canvas.json +142 -0
  20. data/caniuse/features-json/css-counters.json +146 -0
  21. data/caniuse/features-json/css-featurequeries.json +150 -0
  22. data/caniuse/features-json/css-filters.json +155 -0
  23. data/caniuse/features-json/css-fixed.json +151 -0
  24. data/caniuse/features-json/css-gencontent.json +151 -0
  25. data/caniuse/features-json/css-gradients.json +154 -0
  26. data/caniuse/features-json/css-grid.json +150 -0
  27. data/caniuse/features-json/css-hyphens.json +146 -0
  28. data/caniuse/features-json/css-masks.json +142 -0
  29. data/caniuse/features-json/css-mediaqueries.json +152 -0
  30. data/caniuse/features-json/css-opacity.json +142 -0
  31. data/caniuse/features-json/css-reflections.json +142 -0
  32. data/caniuse/features-json/css-regions.json +146 -0
  33. data/caniuse/features-json/css-repeating-gradients.json +146 -0
  34. data/caniuse/features-json/css-resize.json +142 -0
  35. data/caniuse/features-json/css-sel2.json +156 -0
  36. data/caniuse/features-json/css-sel3.json +150 -0
  37. data/caniuse/features-json/css-table.json +148 -0
  38. data/caniuse/features-json/css-textshadow.json +152 -0
  39. data/caniuse/features-json/css-transitions.json +165 -0
  40. data/caniuse/features-json/css3-boxsizing.json +152 -0
  41. data/caniuse/features-json/css3-colors.json +154 -0
  42. data/caniuse/features-json/css3-conditional.json +145 -0
  43. data/caniuse/features-json/datalist.json +150 -0
  44. data/caniuse/features-json/dataset.json +152 -0
  45. data/caniuse/features-json/datauri.json +150 -0
  46. data/caniuse/features-json/details.json +150 -0
  47. data/caniuse/features-json/deviceorientation.json +142 -0
  48. data/caniuse/features-json/download.json +146 -0
  49. data/caniuse/features-json/dragndrop.json +152 -0
  50. data/caniuse/features-json/eot.json +146 -0
  51. data/caniuse/features-json/eventsource.json +148 -0
  52. data/caniuse/features-json/fileapi.json +142 -0
  53. data/caniuse/features-json/filereader.json +142 -0
  54. data/caniuse/features-json/filesystem.json +142 -0
  55. data/caniuse/features-json/flexbox.json +156 -0
  56. data/caniuse/features-json/font-feature.json +150 -0
  57. data/caniuse/features-json/fontface.json +156 -0
  58. data/caniuse/features-json/form-validation.json +141 -0
  59. data/caniuse/features-json/forms.json +151 -0
  60. data/caniuse/features-json/fullscreen.json +150 -0
  61. data/caniuse/features-json/geolocation.json +144 -0
  62. data/caniuse/features-json/getcomputedstyle.json +152 -0
  63. data/caniuse/features-json/getelementsbyclassname.json +145 -0
  64. data/caniuse/features-json/hashchange.json +155 -0
  65. data/caniuse/features-json/history.json +156 -0
  66. data/caniuse/features-json/html5semantic.json +150 -0
  67. data/caniuse/features-json/iframe-sandbox.json +146 -0
  68. data/caniuse/features-json/indexeddb.json +148 -0
  69. data/caniuse/features-json/inline-block.json +146 -0
  70. data/caniuse/features-json/input-color.json +146 -0
  71. data/caniuse/features-json/input-datetime.json +146 -0
  72. data/caniuse/features-json/input-number.json +146 -0
  73. data/caniuse/features-json/input-placeholder.json +146 -0
  74. data/caniuse/features-json/input-range.json +150 -0
  75. data/caniuse/features-json/json.json +146 -0
  76. data/caniuse/features-json/matchesselector.json +143 -0
  77. data/caniuse/features-json/matchmedia.json +151 -0
  78. data/caniuse/features-json/mathml.json +158 -0
  79. data/caniuse/features-json/menu.json +146 -0
  80. data/caniuse/features-json/minmaxwh.json +148 -0
  81. data/caniuse/features-json/mpeg4.json +148 -0
  82. data/caniuse/features-json/multibackgrounds.json +148 -0
  83. data/caniuse/features-json/multicolumn.json +154 -0
  84. data/caniuse/features-json/namevalue-storage.json +150 -0
  85. data/caniuse/features-json/nav-timing.json +147 -0
  86. data/caniuse/features-json/notifications.json +146 -0
  87. data/caniuse/features-json/object-fit.json +142 -0
  88. data/caniuse/features-json/offline-apps.json +152 -0
  89. data/caniuse/features-json/ogv.json +142 -0
  90. data/caniuse/features-json/outline.json +148 -0
  91. data/caniuse/features-json/pagevisibility.json +142 -0
  92. data/caniuse/features-json/png-alpha.json +148 -0
  93. data/caniuse/features-json/pointer-events.json +144 -0
  94. data/caniuse/features-json/progressmeter.json +150 -0
  95. data/caniuse/features-json/queryselector.json +150 -0
  96. data/caniuse/features-json/rellist.json +143 -0
  97. data/caniuse/features-json/rem.json +144 -0
  98. data/caniuse/features-json/requestanimationframe.json +146 -0
  99. data/caniuse/features-json/ruby.json +146 -0
  100. data/caniuse/features-json/script-async.json +147 -0
  101. data/caniuse/features-json/script-defer.json +143 -0
  102. data/caniuse/features-json/sharedworkers.json +146 -0
  103. data/caniuse/features-json/spdy.json +146 -0
  104. data/caniuse/features-json/sql-storage.json +142 -0
  105. data/caniuse/features-json/stream.json +143 -0
  106. data/caniuse/features-json/stricttransportsecurity.json +146 -0
  107. data/caniuse/features-json/style-scoped.json +151 -0
  108. data/caniuse/features-json/svg-css.json +145 -0
  109. data/caniuse/features-json/svg-filters.json +148 -0
  110. data/caniuse/features-json/svg-fonts.json +146 -0
  111. data/caniuse/features-json/svg-fragment.json +142 -0
  112. data/caniuse/features-json/svg-html.json +150 -0
  113. data/caniuse/features-json/svg-html5.json +147 -0
  114. data/caniuse/features-json/svg-img.json +148 -0
  115. data/caniuse/features-json/svg-smil.json +152 -0
  116. data/caniuse/features-json/svg.json +158 -0
  117. data/caniuse/features-json/testfeat.json +142 -0
  118. data/caniuse/features-json/text-overflow.json +150 -0
  119. data/caniuse/features-json/text-stroke.json +146 -0
  120. data/caniuse/features-json/touch.json +156 -0
  121. data/caniuse/features-json/transforms2d.json +160 -0
  122. data/caniuse/features-json/transforms3d.json +150 -0
  123. data/caniuse/features-json/ttf.json +139 -0
  124. data/caniuse/features-json/typedarrays.json +147 -0
  125. data/caniuse/features-json/use-strict.json +146 -0
  126. data/caniuse/features-json/user-select-none.json +142 -0
  127. data/caniuse/features-json/video.json +154 -0
  128. data/caniuse/features-json/viewport-units.json +147 -0
  129. data/caniuse/features-json/wai-aria.json +158 -0
  130. data/caniuse/features-json/webgl.json +158 -0
  131. data/caniuse/features-json/webm.json +150 -0
  132. data/caniuse/features-json/websockets.json +150 -0
  133. data/caniuse/features-json/webworkers.json +150 -0
  134. data/caniuse/features-json/woff.json +142 -0
  135. data/caniuse/features-json/word-break.json +142 -0
  136. data/caniuse/features-json/wordwrap.json +146 -0
  137. data/caniuse/features-json/x-doc-messaging.json +152 -0
  138. data/caniuse/features-json/xhr2.json +153 -0
  139. data/caniuse/features-json/xhtml.json +146 -0
  140. data/caniuse/features-json/xhtmlsmil.json +146 -0
  141. data/lib/rack/caniuse.rb +15 -9
  142. metadata +140 -2
  143. data/Rakefile +0 -8
@@ -0,0 +1,153 @@
1
+ {
2
+ "title":"XMLHttpRequest 2",
3
+ "description":"Adds more functionality to AJAX requests like file uploads, transfer progress information and the ability to send form data.",
4
+ "spec":"http://www.w3.org/TR/XMLHttpRequest2/",
5
+ "status":"wd",
6
+ "links":[
7
+ {
8
+ "url":"https://developer.mozilla.org/en/XMLHttpRequest/FormData",
9
+ "title":"MDN article on FormData"
10
+ },
11
+ {
12
+ "url":"http://www.profilepicture.co.uk/tutorials/ajax-file-upload-xmlhttprequest-level-2/",
13
+ "title":"Article with file upload demo"
14
+ },
15
+ {
16
+ "url":"https://github.com/3nr1c/jUri.js",
17
+ "title":"Polyfill for FormData object"
18
+ }
19
+ ],
20
+ "bugs":[
21
+ {
22
+ "description":"In both Firefox 9 and Chrome 16, xhr.timeout and xhr.ontimeout don't appear to be supported."
23
+ }
24
+ ],
25
+ "categories":[
26
+ "JS API",
27
+ "DOM"
28
+ ],
29
+ "stats":{
30
+ "ie":{
31
+ "5.5":"n",
32
+ "6":"n",
33
+ "7":"n",
34
+ "8":"n",
35
+ "9":"n",
36
+ "10":"y"
37
+ },
38
+ "firefox":{
39
+ "2":"n",
40
+ "3":"n",
41
+ "3.5":"a",
42
+ "3.6":"a",
43
+ "4":"y",
44
+ "5":"y",
45
+ "6":"y",
46
+ "7":"y",
47
+ "8":"y",
48
+ "9":"y",
49
+ "10":"y",
50
+ "11":"y",
51
+ "12":"y",
52
+ "13":"y",
53
+ "14":"y",
54
+ "15":"y",
55
+ "16":"y",
56
+ "17":"y",
57
+ "18":"y",
58
+ "19":"y",
59
+ "20":"y"
60
+ },
61
+ "chrome":{
62
+ "4":"u",
63
+ "5":"u",
64
+ "6":"u",
65
+ "7":"y",
66
+ "8":"y",
67
+ "9":"y",
68
+ "10":"y",
69
+ "11":"y",
70
+ "12":"y",
71
+ "13":"y",
72
+ "14":"y",
73
+ "15":"y",
74
+ "16":"y",
75
+ "17":"y",
76
+ "18":"y",
77
+ "19":"y",
78
+ "20":"y",
79
+ "21":"y",
80
+ "22":"y",
81
+ "23":"y",
82
+ "24":"y",
83
+ "25":"y",
84
+ "26":"y"
85
+ },
86
+ "safari":{
87
+ "3.1":"n",
88
+ "3.2":"n",
89
+ "4":"n",
90
+ "5":"y",
91
+ "5.1":"y",
92
+ "6":"y"
93
+ },
94
+ "opera":{
95
+ "9":"n",
96
+ "9.5-9.6":"n",
97
+ "10.0-10.1":"n",
98
+ "10.5":"n",
99
+ "10.6":"n",
100
+ "11":"n",
101
+ "11.1":"n",
102
+ "11.5":"n",
103
+ "11.6":"n",
104
+ "12":"y",
105
+ "12.1":"y",
106
+ "12.5":"y"
107
+ },
108
+ "ios_saf":{
109
+ "3.2":"n",
110
+ "4.0-4.1":"n",
111
+ "4.2-4.3":"n",
112
+ "5.0-5.1":"y",
113
+ "6":"y"
114
+ },
115
+ "op_mini":{
116
+ "5.0-7.0":"n"
117
+ },
118
+ "android":{
119
+ "2.1":"n",
120
+ "2.2":"n",
121
+ "2.3":"n",
122
+ "3":"y",
123
+ "4":"y",
124
+ "4.1":"y",
125
+ "4.2":"y"
126
+ },
127
+ "bb":{
128
+ "7":"y",
129
+ "10":"y"
130
+ },
131
+ "op_mob":{
132
+ "10":"n",
133
+ "11":"n",
134
+ "11.1":"n",
135
+ "11.5":"n",
136
+ "12":"y",
137
+ "12.1":"y"
138
+ },
139
+ "and_chr":{
140
+ "0":"y"
141
+ },
142
+ "and_ff":{
143
+ "0":"y"
144
+ }
145
+ },
146
+ "notes":"Firefox 3.5 and 3.6 partial support refers to only including support for the progress event.",
147
+ "usage_perc_y":63.36,
148
+ "usage_perc_a":0.55,
149
+ "ucprefix":false,
150
+ "parent":"",
151
+ "keywords":"formdata",
152
+ "shown":true
153
+ }
@@ -0,0 +1,146 @@
1
+ {
2
+ "title":"XHTML served as application/xhtml+xml",
3
+ "description":"A strict form of HTML, and allows embedding of other XML languages",
4
+ "spec":"http://www.w3.org/TR/xhtml1/",
5
+ "status":"rec",
6
+ "links":[
7
+ {
8
+ "url":"http://www.xmlplease.com/xhtml/xhtml5polyglot/",
9
+ "title":"Information on XHTML5"
10
+ },
11
+ {
12
+ "url":"http://en.wikipedia.org/wiki/XHTML",
13
+ "title":"Wikipedia"
14
+ }
15
+ ],
16
+ "bugs":[
17
+
18
+ ],
19
+ "categories":[
20
+ "Other"
21
+ ],
22
+ "stats":{
23
+ "ie":{
24
+ "5.5":"n",
25
+ "6":"n",
26
+ "7":"n",
27
+ "8":"n",
28
+ "9":"y",
29
+ "10":"y"
30
+ },
31
+ "firefox":{
32
+ "2":"y",
33
+ "3":"y",
34
+ "3.5":"y",
35
+ "3.6":"y",
36
+ "4":"y",
37
+ "5":"y",
38
+ "6":"y",
39
+ "7":"y",
40
+ "8":"y",
41
+ "9":"y",
42
+ "10":"y",
43
+ "11":"y",
44
+ "12":"y",
45
+ "13":"y",
46
+ "14":"y",
47
+ "15":"y",
48
+ "16":"y",
49
+ "17":"y",
50
+ "18":"y",
51
+ "19":"y",
52
+ "20":"y"
53
+ },
54
+ "chrome":{
55
+ "4":"y",
56
+ "5":"y",
57
+ "6":"y",
58
+ "7":"y",
59
+ "8":"y",
60
+ "9":"y",
61
+ "10":"y",
62
+ "11":"y",
63
+ "12":"y",
64
+ "13":"y",
65
+ "14":"y",
66
+ "15":"y",
67
+ "16":"y",
68
+ "17":"y",
69
+ "18":"y",
70
+ "19":"y",
71
+ "20":"y",
72
+ "21":"y",
73
+ "22":"y",
74
+ "23":"y",
75
+ "24":"y",
76
+ "25":"y",
77
+ "26":"y"
78
+ },
79
+ "safari":{
80
+ "3.1":"y",
81
+ "3.2":"y",
82
+ "4":"y",
83
+ "5":"y",
84
+ "5.1":"y",
85
+ "6":"y"
86
+ },
87
+ "opera":{
88
+ "9":"y",
89
+ "9.5-9.6":"y",
90
+ "10.0-10.1":"y",
91
+ "10.5":"y",
92
+ "10.6":"y",
93
+ "11":"y",
94
+ "11.1":"y",
95
+ "11.5":"y",
96
+ "11.6":"y",
97
+ "12":"y",
98
+ "12.1":"y",
99
+ "12.5":"y"
100
+ },
101
+ "ios_saf":{
102
+ "3.2":"y",
103
+ "4.0-4.1":"y",
104
+ "4.2-4.3":"y",
105
+ "5.0-5.1":"y",
106
+ "6":"y"
107
+ },
108
+ "op_mini":{
109
+ "5.0-7.0":"y"
110
+ },
111
+ "android":{
112
+ "2.1":"y",
113
+ "2.2":"y",
114
+ "2.3":"y",
115
+ "3":"y",
116
+ "4":"y",
117
+ "4.1":"y",
118
+ "4.2":"y"
119
+ },
120
+ "bb":{
121
+ "7":"y",
122
+ "10":"y"
123
+ },
124
+ "op_mob":{
125
+ "10":"y",
126
+ "11":"y",
127
+ "11.1":"y",
128
+ "11.5":"y",
129
+ "12":"y",
130
+ "12.1":"y"
131
+ },
132
+ "and_chr":{
133
+ "0":"y"
134
+ },
135
+ "and_ff":{
136
+ "0":"y"
137
+ }
138
+ },
139
+ "notes":"The XHTML syntax is very close to HTML, and thus is almost always (<a href=\"https://developer.mozilla.org/en-US/docs/XHTML#MIME_type_versus_DOCTYPE\">incorrectly</a>) served as text/html on the web.",
140
+ "usage_perc_y":84.84,
141
+ "usage_perc_a":0,
142
+ "ucprefix":false,
143
+ "parent":"",
144
+ "keywords":"xhtml+xml",
145
+ "shown":true
146
+ }
@@ -0,0 +1,146 @@
1
+ {
2
+ "title":"XHTML+SMIL animation",
3
+ "description":"Method of using SMIL animation in web pages",
4
+ "spec":"http://www.w3.org/TR/XHTMLplusSMIL/",
5
+ "status":"unoff",
6
+ "links":[
7
+ {
8
+ "url":"http://en.wikipedia.org/wiki/XHTML%2BSMIL",
9
+ "title":"Wikipedia"
10
+ },
11
+ {
12
+ "url":"http://leunen.me/fakesmile/",
13
+ "title":"JS library to support XHTML+SMIL"
14
+ }
15
+ ],
16
+ "bugs":[
17
+
18
+ ],
19
+ "categories":[
20
+ "Other"
21
+ ],
22
+ "stats":{
23
+ "ie":{
24
+ "5.5":"n",
25
+ "6":"a",
26
+ "7":"a",
27
+ "8":"a",
28
+ "9":"n",
29
+ "10":"n"
30
+ },
31
+ "firefox":{
32
+ "2":"p",
33
+ "3":"p",
34
+ "3.5":"p",
35
+ "3.6":"p",
36
+ "4":"p",
37
+ "5":"p",
38
+ "6":"p",
39
+ "7":"p",
40
+ "8":"p",
41
+ "9":"p",
42
+ "10":"p",
43
+ "11":"p",
44
+ "12":"p",
45
+ "13":"p",
46
+ "14":"p",
47
+ "15":"p",
48
+ "16":"p",
49
+ "17":"p",
50
+ "18":"p",
51
+ "19":"p",
52
+ "20":"p"
53
+ },
54
+ "chrome":{
55
+ "4":"p",
56
+ "5":"p",
57
+ "6":"p",
58
+ "7":"p",
59
+ "8":"p",
60
+ "9":"p",
61
+ "10":"p",
62
+ "11":"p",
63
+ "12":"p",
64
+ "13":"p",
65
+ "14":"p",
66
+ "15":"p",
67
+ "16":"p",
68
+ "17":"p",
69
+ "18":"p",
70
+ "19":"p",
71
+ "20":"p",
72
+ "21":"p",
73
+ "22":"p",
74
+ "23":"p",
75
+ "24":"p",
76
+ "25":"p",
77
+ "26":"p"
78
+ },
79
+ "safari":{
80
+ "3.1":"p",
81
+ "3.2":"p",
82
+ "4":"p",
83
+ "5":"p",
84
+ "5.1":"p",
85
+ "6":"p"
86
+ },
87
+ "opera":{
88
+ "9":"p",
89
+ "9.5-9.6":"p",
90
+ "10.0-10.1":"p",
91
+ "10.5":"p",
92
+ "10.6":"p",
93
+ "11":"p",
94
+ "11.1":"p",
95
+ "11.5":"p",
96
+ "11.6":"p",
97
+ "12":"p",
98
+ "12.1":"p",
99
+ "12.5":"p"
100
+ },
101
+ "ios_saf":{
102
+ "3.2":"p",
103
+ "4.0-4.1":"p",
104
+ "4.2-4.3":"p",
105
+ "5.0-5.1":"p",
106
+ "6":"p"
107
+ },
108
+ "op_mini":{
109
+ "5.0-7.0":"p"
110
+ },
111
+ "android":{
112
+ "2.1":"p",
113
+ "2.2":"p",
114
+ "2.3":"p",
115
+ "3":"p",
116
+ "4":"p",
117
+ "4.1":"p",
118
+ "4.2":"p"
119
+ },
120
+ "bb":{
121
+ "7":"p",
122
+ "10":"p"
123
+ },
124
+ "op_mob":{
125
+ "10":"p",
126
+ "11":"p",
127
+ "11.1":"p",
128
+ "11.5":"p",
129
+ "12":"p",
130
+ "12.1":"p"
131
+ },
132
+ "and_chr":{
133
+ "0":"p"
134
+ },
135
+ "and_ff":{
136
+ "0":"p"
137
+ }
138
+ },
139
+ "notes":"Internet Explorer supports the W3C proposal HTML+TIME, which is largely the same as XHTML+SMIL",
140
+ "usage_perc_y":0,
141
+ "usage_perc_a":10.54,
142
+ "ucprefix":false,
143
+ "parent":"xhtml",
144
+ "keywords":"",
145
+ "shown":true
146
+ }
data/lib/rack/caniuse.rb CHANGED
@@ -10,32 +10,38 @@ module Rack
10
10
  redirect: 'http://browsehappy.com/'
11
11
  }
12
12
 
13
+ Base = ::File.join(::File.dirname(__FILE__), '..', '..')
14
+
13
15
  def initialize(app, options = {})
14
- @features = {}
16
+
15
17
  options.reverse_merge!(DefaultOptions)
18
+ @app, @options, @features = app, options, {}
19
+
16
20
  options[:features].each do |feature|
17
- path = File.join('../caniuse',
21
+ path = ::File.join(Base, 'caniuse',
18
22
  'features-json', feature + '.json')
19
- unless File.readable?(path)
20
- puts path
23
+ unless ::File.readable?(path)
21
24
  raise "Invalid feature #{feature}."
22
25
  end
23
- hash = JSON.parse(File.read(path))
26
+ hash = JSON.parse(::File.read(path))
24
27
  @features[feature] = hash
25
28
  end
26
- @app, @options = app, options
29
+
27
30
  end
28
31
 
29
32
  def call(env)
30
- agent, lang = env['HTTP_USER_AGENT'], env['Accept-Language']
31
- browser = Browser.new(ua: agent, accept_language: lang)
33
+ agent = env['HTTP_USER_AGENT']
34
+ browser = Browser.new(ua: agent,
35
+ accept_language: 'en-us')
32
36
  validate_support(browser)
37
+ @app.call(env)
33
38
  end
34
39
 
35
40
  private
36
41
 
37
42
  def validate_support(browser)
38
- name, version = browser.name, browser.version
43
+ name = browser.name.downcase
44
+ version = browser.version
39
45
  unsupported_features = []
40
46
  @features.each do |feature,info|
41
47
  browser_stats = info['stats'][name]