nested_form_fields 0.0.9 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. data/.gitignore +5 -1
  2. data/.rspec +2 -0
  3. data/.travis.yml +5 -0
  4. data/README.md +1 -1
  5. data/Rakefile +5 -0
  6. data/lib/nested_form_fields/version.rb +1 -1
  7. data/nested_form_fields.gemspec +12 -0
  8. data/spec/dummy/README.rdoc +261 -0
  9. data/spec/dummy/Rakefile +7 -0
  10. data/spec/dummy/app/assets/javascripts/application.js +16 -0
  11. data/spec/dummy/app/assets/javascripts/users.js.coffee +3 -0
  12. data/spec/dummy/app/assets/stylesheets/application.css.scss +44 -0
  13. data/spec/dummy/app/assets/stylesheets/normalize.css.scss +504 -0
  14. data/spec/dummy/app/assets/stylesheets/users.css.scss +29 -0
  15. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  16. data/spec/dummy/app/controllers/users_controller.rb +37 -0
  17. data/spec/dummy/app/models/project.rb +6 -0
  18. data/spec/dummy/app/models/todo.rb +4 -0
  19. data/spec/dummy/app/models/user.rb +5 -0
  20. data/spec/dummy/app/views/layouts/_messages.html.haml +2 -0
  21. data/spec/dummy/app/views/layouts/_navigation.html.haml +0 -0
  22. data/spec/dummy/app/views/layouts/application.html.haml +21 -0
  23. data/spec/dummy/app/views/users/edit.html.haml +32 -0
  24. data/spec/dummy/app/views/users/show.html.haml +2 -0
  25. data/spec/dummy/config.ru +4 -0
  26. data/spec/dummy/config/application.rb +64 -0
  27. data/spec/dummy/config/boot.rb +10 -0
  28. data/spec/dummy/config/database.yml +25 -0
  29. data/spec/dummy/config/environment.rb +5 -0
  30. data/spec/dummy/config/environments/development.rb +37 -0
  31. data/spec/dummy/config/environments/production.rb +67 -0
  32. data/spec/dummy/config/environments/test.rb +37 -0
  33. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  34. data/spec/dummy/config/initializers/inflections.rb +15 -0
  35. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  36. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  37. data/spec/dummy/config/initializers/session_store.rb +8 -0
  38. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  39. data/spec/dummy/config/locales/en.yml +5 -0
  40. data/spec/dummy/config/routes.rb +5 -0
  41. data/spec/dummy/db/development.sqlite3 +0 -0
  42. data/spec/dummy/db/migrate/20120518212100_create_users.rb +9 -0
  43. data/spec/dummy/db/migrate/20120523095218_create_projects.rb +10 -0
  44. data/spec/dummy/db/migrate/20120523095357_create_todos.rb +10 -0
  45. data/spec/dummy/db/schema.rb +39 -0
  46. data/spec/dummy/db/test.sqlite3 +0 -0
  47. data/spec/dummy/lib/assets/.gitkeep +0 -0
  48. data/spec/dummy/public/404.html +26 -0
  49. data/spec/dummy/public/422.html +26 -0
  50. data/spec/dummy/public/500.html +25 -0
  51. data/spec/dummy/public/favicon.ico +0 -0
  52. data/spec/dummy/script/rails +6 -0
  53. data/spec/integration/nested_form_fields_spec.rb +81 -0
  54. data/spec/spec_helper.rb +43 -0
  55. metadata +212 -4
data/.gitignore CHANGED
@@ -15,4 +15,8 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
- .idea
18
+ .idea
19
+ .sass-cache
20
+ spec/dummy/log
21
+ spec/dummy/tmp
22
+ .DS_Store
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format progress
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ rvm:
2
+ - 1.9.2
3
+ before_script:
4
+ - "export DISPLAY=:99.0"
5
+ - "sh -e /etc/init.d/xvfb start"
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Nested Form Fields
1
+ # Nested Form Fields [![Build Status](https://secure.travis-ci.org/ncri/nested_form_fields.png)](http://travis-ci.org/ncri/nested_form_fields)
2
2
 
3
3
  This Rails gem helps creating forms for models with nested has_many associations.
4
4
 
data/Rakefile CHANGED
@@ -1,2 +1,7 @@
1
1
  #!/usr/bin/env rake
2
2
  require "bundler/gem_tasks"
3
+
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+ task default: :spec
@@ -1,3 +1,3 @@
1
1
  module NestedFormFields
2
- VERSION = "0.0.9"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -15,4 +15,16 @@ Gem::Specification.new do |gem|
15
15
  gem.name = "nested_form_fields"
16
16
  gem.require_paths = ["lib"]
17
17
  gem.version = NestedFormFields::VERSION
18
+
19
+ gem.add_dependency 'rails', '>= 3.1.0'
20
+
21
+ gem.add_development_dependency 'jquery-rails'
22
+ gem.add_development_dependency 'rspec-rails'
23
+ gem.add_development_dependency 'assert_difference'
24
+ gem.add_development_dependency 'capybara'
25
+ gem.add_development_dependency 'selenium-webdriver'
26
+ gem.add_development_dependency 'sqlite3'
27
+ gem.add_development_dependency 'haml', '>= 3.1.5'
28
+ gem.add_development_dependency 'sass-rails', '~> 3.2.3'
29
+ gem.add_development_dependency 'coffee-rails', '~> 3.2.1'
18
30
  end
@@ -0,0 +1,261 @@
1
+ == Welcome to Rails
2
+
3
+ Rails is a web-application framework that includes everything needed to create
4
+ database-backed web applications according to the Model-View-Control pattern.
5
+
6
+ This pattern splits the view (also called the presentation) into "dumb"
7
+ templates that are primarily responsible for inserting pre-built data in between
8
+ HTML tags. The model contains the "smart" domain objects (such as Account,
9
+ Product, Person, Post) that holds all the business logic and knows how to
10
+ persist themselves to a database. The controller handles the incoming requests
11
+ (such as Save New Account, Update Product, Show Post) by manipulating the model
12
+ and directing data to the view.
13
+
14
+ In Rails, the model is handled by what's called an object-relational mapping
15
+ layer entitled Active Record. This layer allows you to present the data from
16
+ database rows as objects and embellish these data objects with business logic
17
+ methods. You can read more about Active Record in
18
+ link:files/vendor/rails/activerecord/README.html.
19
+
20
+ The controller and view are handled by the Action Pack, which handles both
21
+ layers by its two parts: Action View and Action Controller. These two layers
22
+ are bundled in a single package due to their heavy interdependence. This is
23
+ unlike the relationship between the Active Record and Action Pack that is much
24
+ more separate. Each of these packages can be used independently outside of
25
+ Rails. You can read more about Action Pack in
26
+ link:files/vendor/rails/actionpack/README.html.
27
+
28
+
29
+ == Getting Started
30
+
31
+ 1. At the command prompt, create a new Rails application:
32
+ <tt>rails new myapp</tt> (where <tt>myapp</tt> is the application name)
33
+
34
+ 2. Change directory to <tt>myapp</tt> and start the web server:
35
+ <tt>cd myapp; rails server</tt> (run with --help for options)
36
+
37
+ 3. Go to http://localhost:3000/ and you'll see:
38
+ "Welcome aboard: You're riding Ruby on Rails!"
39
+
40
+ 4. Follow the guidelines to start developing your application. You can find
41
+ the following resources handy:
42
+
43
+ * The Getting Started Guide: http://guides.rubyonrails.org/getting_started.html
44
+ * Ruby on Rails Tutorial Book: http://www.railstutorial.org/
45
+
46
+
47
+ == Debugging Rails
48
+
49
+ Sometimes your application goes wrong. Fortunately there are a lot of tools that
50
+ will help you debug it and get it back on the rails.
51
+
52
+ First area to check is the application log files. Have "tail -f" commands
53
+ running on the server.log and development.log. Rails will automatically display
54
+ debugging and runtime information to these files. Debugging info will also be
55
+ shown in the browser on requests from 127.0.0.1.
56
+
57
+ You can also log your own messages directly into the log file from your code
58
+ using the Ruby logger class from inside your controllers. Example:
59
+
60
+ class WeblogController < ActionController::Base
61
+ def destroy
62
+ @weblog = Weblog.find(params[:id])
63
+ @weblog.destroy
64
+ logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
65
+ end
66
+ end
67
+
68
+ The result will be a message in your log file along the lines of:
69
+
70
+ Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1!
71
+
72
+ More information on how to use the logger is at http://www.ruby-doc.org/core/
73
+
74
+ Also, Ruby documentation can be found at http://www.ruby-lang.org/. There are
75
+ several books available online as well:
76
+
77
+ * Programming Ruby: http://www.ruby-doc.org/docs/ProgrammingRuby/ (Pickaxe)
78
+ * Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
79
+
80
+ These two books will bring you up to speed on the Ruby language and also on
81
+ programming in general.
82
+
83
+
84
+ == Debugger
85
+
86
+ Debugger support is available through the debugger command when you start your
87
+ Mongrel or WEBrick server with --debugger. This means that you can break out of
88
+ execution at any point in the code, investigate and change the model, and then,
89
+ resume execution! You need to install ruby-debug to run the server in debugging
90
+ mode. With gems, use <tt>sudo gem install ruby-debug</tt>. Example:
91
+
92
+ class WeblogController < ActionController::Base
93
+ def index
94
+ @posts = Post.all
95
+ debugger
96
+ end
97
+ end
98
+
99
+ So the controller will accept the action, run the first line, then present you
100
+ with a IRB prompt in the server window. Here you can do things like:
101
+
102
+ >> @posts.inspect
103
+ => "[#<Post:0x14a6be8
104
+ @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>,
105
+ #<Post:0x14a6620
106
+ @attributes={"title"=>"Rails", "body"=>"Only ten..", "id"=>"2"}>]"
107
+ >> @posts.first.title = "hello from a debugger"
108
+ => "hello from a debugger"
109
+
110
+ ...and even better, you can examine how your runtime objects actually work:
111
+
112
+ >> f = @posts.first
113
+ => #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
114
+ >> f.
115
+ Display all 152 possibilities? (y or n)
116
+
117
+ Finally, when you're ready to resume execution, you can enter "cont".
118
+
119
+
120
+ == Console
121
+
122
+ The console is a Ruby shell, which allows you to interact with your
123
+ application's domain model. Here you'll have all parts of the application
124
+ configured, just like it is when the application is running. You can inspect
125
+ domain models, change values, and save to the database. Starting the script
126
+ without arguments will launch it in the development environment.
127
+
128
+ To start the console, run <tt>rails console</tt> from the application
129
+ directory.
130
+
131
+ Options:
132
+
133
+ * Passing the <tt>-s, --sandbox</tt> argument will rollback any modifications
134
+ made to the database.
135
+ * Passing an environment name as an argument will load the corresponding
136
+ environment. Example: <tt>rails console production</tt>.
137
+
138
+ To reload your controllers and models after launching the console run
139
+ <tt>reload!</tt>
140
+
141
+ More information about irb can be found at:
142
+ link:http://www.rubycentral.org/pickaxe/irb.html
143
+
144
+
145
+ == dbconsole
146
+
147
+ You can go to the command line of your database directly through <tt>rails
148
+ dbconsole</tt>. You would be connected to the database with the credentials
149
+ defined in database.yml. Starting the script without arguments will connect you
150
+ to the development database. Passing an argument will connect you to a different
151
+ database, like <tt>rails dbconsole production</tt>. Currently works for MySQL,
152
+ PostgreSQL and SQLite 3.
153
+
154
+ == Description of Contents
155
+
156
+ The default directory structure of a generated Ruby on Rails application:
157
+
158
+ |-- app
159
+ | |-- assets
160
+ | |-- images
161
+ | |-- javascripts
162
+ | `-- stylesheets
163
+ | |-- controllers
164
+ | |-- helpers
165
+ | |-- mailers
166
+ | |-- models
167
+ | `-- views
168
+ | `-- layouts
169
+ |-- config
170
+ | |-- environments
171
+ | |-- initializers
172
+ | `-- locales
173
+ |-- db
174
+ |-- doc
175
+ |-- lib
176
+ | `-- tasks
177
+ |-- log
178
+ |-- public
179
+ |-- script
180
+ |-- test
181
+ | |-- fixtures
182
+ | |-- functional
183
+ | |-- integration
184
+ | |-- performance
185
+ | `-- unit
186
+ |-- tmp
187
+ | |-- cache
188
+ | |-- pids
189
+ | |-- sessions
190
+ | `-- sockets
191
+ `-- vendor
192
+ |-- assets
193
+ `-- stylesheets
194
+ `-- plugins
195
+
196
+ app
197
+ Holds all the code that's specific to this particular application.
198
+
199
+ app/assets
200
+ Contains subdirectories for images, stylesheets, and JavaScript files.
201
+
202
+ app/controllers
203
+ Holds controllers that should be named like weblogs_controller.rb for
204
+ automated URL mapping. All controllers should descend from
205
+ ApplicationController which itself descends from ActionController::Base.
206
+
207
+ app/models
208
+ Holds models that should be named like post.rb. Models descend from
209
+ ActiveRecord::Base by default.
210
+
211
+ app/views
212
+ Holds the template files for the view that should be named like
213
+ weblogs/index.html.erb for the WeblogsController#index action. All views use
214
+ eRuby syntax by default.
215
+
216
+ app/views/layouts
217
+ Holds the template files for layouts to be used with views. This models the
218
+ common header/footer method of wrapping views. In your views, define a layout
219
+ using the <tt>layout :default</tt> and create a file named default.html.erb.
220
+ Inside default.html.erb, call <% yield %> to render the view using this
221
+ layout.
222
+
223
+ app/helpers
224
+ Holds view helpers that should be named like weblogs_helper.rb. These are
225
+ generated for you automatically when using generators for controllers.
226
+ Helpers can be used to wrap functionality for your views into methods.
227
+
228
+ config
229
+ Configuration files for the Rails environment, the routing map, the database,
230
+ and other dependencies.
231
+
232
+ db
233
+ Contains the database schema in schema.rb. db/migrate contains all the
234
+ sequence of Migrations for your schema.
235
+
236
+ doc
237
+ This directory is where your application documentation will be stored when
238
+ generated using <tt>rake doc:app</tt>
239
+
240
+ lib
241
+ Application specific libraries. Basically, any kind of custom code that
242
+ doesn't belong under controllers, models, or helpers. This directory is in
243
+ the load path.
244
+
245
+ public
246
+ The directory available for the web server. Also contains the dispatchers and the
247
+ default HTML files. This should be set as the DOCUMENT_ROOT of your web
248
+ server.
249
+
250
+ script
251
+ Helper scripts for automation and generation.
252
+
253
+ test
254
+ Unit and functional tests along with fixtures. When using the rails generate
255
+ command, template test files will be generated for you and placed in this
256
+ directory.
257
+
258
+ vendor
259
+ External libraries that the application depends on. Also includes the plugins
260
+ subdirectory. If the app has frozen rails, those gems also go here, under
261
+ vendor/rails/. This directory is in the load path.
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env rake
2
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
3
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
4
+
5
+ require File.expand_path('../config/application', __FILE__)
6
+
7
+ Dummy::Application.load_tasks
@@ -0,0 +1,16 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // the compiled file.
9
+ //
10
+ // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
+ // GO AFTER THE REQUIRES BELOW.
12
+ //
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require nested_form_fields
16
+ //= require_tree .
@@ -0,0 +1,3 @@
1
+ # Place all the behaviors and hooks related to the matching controller here.
2
+ # All this logic will automatically be available in application.js.
3
+ # You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
@@ -0,0 +1,44 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree .
13
+ */
14
+ .brand {
15
+ float: left;
16
+ padding-right: 8px;
17
+ }
18
+ ul.nav {
19
+ list-style: none;
20
+ margin: 0 0 2em;
21
+ padding: 0;
22
+ }
23
+ ul.nav li {
24
+ display: inline;
25
+ }
26
+ #flash_notice, #flash_alert {
27
+ padding: 5px 8px;
28
+ margin: 10px 0;
29
+ }
30
+ #flash_notice {
31
+ background-color: #CFC;
32
+ border: solid 1px #6C6;
33
+ }
34
+ #flash_alert {
35
+ background-color: #FCC;
36
+ border: solid 1px #C66;
37
+ }
38
+
39
+ #main{
40
+ width: 400px;
41
+ margin-left: auto;
42
+ margin-right: auto;
43
+ margin-top: 10px;
44
+ }
@@ -0,0 +1,504 @@
1
+ /*! normalize.css 2012-03-11T12:53 UTC - http://github.com/necolas/normalize.css */
2
+
3
+ /* =============================================================================
4
+ HTML5 display definitions
5
+ ========================================================================== */
6
+
7
+ /*
8
+ * Corrects block display not defined in IE6/7/8/9 & FF3
9
+ */
10
+
11
+ article,
12
+ aside,
13
+ details,
14
+ figcaption,
15
+ figure,
16
+ footer,
17
+ header,
18
+ hgroup,
19
+ nav,
20
+ section,
21
+ summary {
22
+ display: block;
23
+ }
24
+
25
+ /*
26
+ * Corrects inline-block display not defined in IE6/7/8/9 & FF3
27
+ */
28
+
29
+ audio,
30
+ canvas,
31
+ video {
32
+ display: inline-block;
33
+ *display: inline;
34
+ *zoom: 1;
35
+ }
36
+
37
+ /*
38
+ * Prevents modern browsers from displaying 'audio' without controls
39
+ * Remove excess height in iOS5 devices
40
+ */
41
+
42
+ audio:not([controls]) {
43
+ display: none;
44
+ height: 0;
45
+ }
46
+
47
+ /*
48
+ * Addresses styling for 'hidden' attribute not present in IE7/8/9, FF3, S4
49
+ * Known issue: no IE6 support
50
+ */
51
+
52
+ [hidden] {
53
+ display: none;
54
+ }
55
+
56
+
57
+ /* =============================================================================
58
+ Base
59
+ ========================================================================== */
60
+
61
+ /*
62
+ * 1. Corrects text resizing oddly in IE6/7 when body font-size is set using em units
63
+ * http://clagnut.com/blog/348/#c790
64
+ * 2. Prevents iOS text size adjust after orientation change, without disabling user zoom
65
+ * www.456bereastreet.com/archive/201012/controlling_text_size_in_safari_for_ios_without_disabling_user_zoom/
66
+ */
67
+
68
+ html {
69
+ font-size: 100%; /* 1 */
70
+ -webkit-text-size-adjust: 100%; /* 2 */
71
+ -ms-text-size-adjust: 100%; /* 2 */
72
+ }
73
+
74
+ /*
75
+ * Addresses font-family inconsistency between 'textarea' and other form elements.
76
+ */
77
+
78
+ html,
79
+ button,
80
+ input,
81
+ select,
82
+ textarea {
83
+ font-family: sans-serif;
84
+ }
85
+
86
+ /*
87
+ * Addresses margins handled incorrectly in IE6/7
88
+ */
89
+
90
+ body {
91
+ margin: 0;
92
+ }
93
+
94
+
95
+ /* =============================================================================
96
+ Links
97
+ ========================================================================== */
98
+
99
+ /*
100
+ * Addresses outline displayed oddly in Chrome
101
+ */
102
+
103
+ a:focus {
104
+ outline: thin dotted;
105
+ }
106
+
107
+ /*
108
+ * Improves readability when focused and also mouse hovered in all browsers
109
+ * people.opera.com/patrickl/experiments/keyboard/test
110
+ */
111
+
112
+ a:hover,
113
+ a:active {
114
+ outline: 0;
115
+ }
116
+
117
+
118
+ /* =============================================================================
119
+ Typography
120
+ ========================================================================== */
121
+
122
+ /*
123
+ * Addresses font sizes and margins set differently in IE6/7
124
+ * Addresses font sizes within 'section' and 'article' in FF4+, Chrome, S5
125
+ */
126
+
127
+ h1 {
128
+ font-size: 2em;
129
+ margin: 0.67em 0;
130
+ }
131
+
132
+ h2 {
133
+ font-size: 1.5em;
134
+ margin: 0.83em 0;
135
+ }
136
+
137
+ h3 {
138
+ font-size: 1.17em;
139
+ margin: 1em 0;
140
+ }
141
+
142
+ h4 {
143
+ font-size: 1em;
144
+ margin: 1.33em 0;
145
+ }
146
+
147
+ h5 {
148
+ font-size: 0.83em;
149
+ margin: 1.67em 0;
150
+ }
151
+
152
+ h6 {
153
+ font-size: 0.75em;
154
+ margin: 2.33em 0;
155
+ }
156
+
157
+ /*
158
+ * Addresses styling not present in IE7/8/9, S5, Chrome
159
+ */
160
+
161
+ abbr[title] {
162
+ border-bottom: 1px dotted;
163
+ }
164
+
165
+ /*
166
+ * Addresses style set to 'bolder' in FF3+, S4/5, Chrome
167
+ */
168
+
169
+ b,
170
+ strong {
171
+ font-weight: bold;
172
+ }
173
+
174
+ blockquote {
175
+ margin: 1em 40px;
176
+ }
177
+
178
+ /*
179
+ * Addresses styling not present in S5, Chrome
180
+ */
181
+
182
+ dfn {
183
+ font-style: italic;
184
+ }
185
+
186
+ /*
187
+ * Addresses styling not present in IE6/7/8/9
188
+ */
189
+
190
+ mark {
191
+ background: #ff0;
192
+ color: #000;
193
+ }
194
+
195
+ /*
196
+ * Addresses margins set differently in IE6/7
197
+ */
198
+
199
+ p,
200
+ pre {
201
+ margin: 1em 0;
202
+ }
203
+
204
+ /*
205
+ * Corrects font family set oddly in IE6, S4/5, Chrome
206
+ * en.wikipedia.org/wiki/User:Davidgothberg/Test59
207
+ */
208
+
209
+ pre,
210
+ code,
211
+ kbd,
212
+ samp {
213
+ font-family: monospace, serif;
214
+ _font-family: 'courier new', monospace;
215
+ font-size: 1em;
216
+ }
217
+
218
+ /*
219
+ * Improves readability of pre-formatted text in all browsers
220
+ */
221
+
222
+ pre {
223
+ white-space: pre;
224
+ white-space: pre-wrap;
225
+ word-wrap: break-word;
226
+ }
227
+
228
+ /*
229
+ * 1. Addresses CSS quotes not supported in IE6/7
230
+ * 2. Addresses quote property not supported in S4
231
+ */
232
+
233
+ /* 1 */
234
+
235
+ q {
236
+ quotes: none;
237
+ }
238
+
239
+ /* 2 */
240
+
241
+ q:before,
242
+ q:after {
243
+ content: '';
244
+ content: none;
245
+ }
246
+
247
+ small {
248
+ font-size: 75%;
249
+ }
250
+
251
+ /*
252
+ * Prevents sub and sup affecting line-height in all browsers
253
+ * gist.github.com/413930
254
+ */
255
+
256
+ sub,
257
+ sup {
258
+ font-size: 75%;
259
+ line-height: 0;
260
+ position: relative;
261
+ vertical-align: baseline;
262
+ }
263
+
264
+ sup {
265
+ top: -0.5em;
266
+ }
267
+
268
+ sub {
269
+ bottom: -0.25em;
270
+ }
271
+
272
+
273
+ /* =============================================================================
274
+ Lists
275
+ ========================================================================== */
276
+
277
+ /*
278
+ * Addresses margins set differently in IE6/7
279
+ */
280
+
281
+ dl,
282
+ menu,
283
+ ol,
284
+ ul {
285
+ margin: 1em 0;
286
+ }
287
+
288
+ dd {
289
+ margin: 0 0 0 40px;
290
+ }
291
+
292
+ /*
293
+ * Addresses paddings set differently in IE6/7
294
+ */
295
+
296
+ menu,
297
+ ol,
298
+ ul {
299
+ padding: 0 0 0 40px;
300
+ }
301
+
302
+ /*
303
+ * Corrects list images handled incorrectly in IE7
304
+ */
305
+
306
+ nav ul,
307
+ nav ol {
308
+ list-style: none;
309
+ list-style-image: none;
310
+ }
311
+
312
+
313
+ /* =============================================================================
314
+ Embedded content
315
+ ========================================================================== */
316
+
317
+ /*
318
+ * 1. Removes border when inside 'a' element in IE6/7/8/9, FF3
319
+ * 2. Improves image quality when scaled in IE7
320
+ * code.flickr.com/blog/2008/11/12/on-ui-quality-the-little-things-client-side-image-resizing/
321
+ */
322
+
323
+ img {
324
+ border: 0; /* 1 */
325
+ -ms-interpolation-mode: bicubic; /* 2 */
326
+ }
327
+
328
+ /*
329
+ * Corrects overflow displayed oddly in IE9
330
+ */
331
+
332
+ svg:not(:root) {
333
+ overflow: hidden;
334
+ }
335
+
336
+
337
+ /* =============================================================================
338
+ Figures
339
+ ========================================================================== */
340
+
341
+ /*
342
+ * Addresses margin not present in IE6/7/8/9, S5, O11
343
+ */
344
+
345
+ figure {
346
+ margin: 0;
347
+ }
348
+
349
+
350
+ /* =============================================================================
351
+ Forms
352
+ ========================================================================== */
353
+
354
+ /*
355
+ * Corrects margin displayed oddly in IE6/7
356
+ */
357
+
358
+ form {
359
+ margin: 0;
360
+ }
361
+
362
+ /*
363
+ * Define consistent border, margin, and padding
364
+ */
365
+
366
+ fieldset {
367
+ border: 1px solid #c0c0c0;
368
+ margin: 0 2px;
369
+ padding: 0.35em 0.625em 0.75em;
370
+ }
371
+
372
+ /*
373
+ * 1. Corrects color not being inherited in IE6/7/8/9
374
+ * 2. Corrects text not wrapping in FF3
375
+ * 3. Corrects alignment displayed oddly in IE6/7
376
+ */
377
+
378
+ legend {
379
+ border: 0; /* 1 */
380
+ padding: 0;
381
+ white-space: normal; /* 2 */
382
+ *margin-left: -7px; /* 3 */
383
+ }
384
+
385
+ /*
386
+ * 1. Corrects font size not being inherited in all browsers
387
+ * 2. Addresses margins set differently in IE6/7, FF3+, S5, Chrome
388
+ * 3. Improves appearance and consistency in all browsers
389
+ */
390
+
391
+ button,
392
+ input,
393
+ select,
394
+ textarea {
395
+ font-size: 100%; /* 1 */
396
+ margin: 0; /* 2 */
397
+ vertical-align: baseline; /* 3 */
398
+ *vertical-align: middle; /* 3 */
399
+ }
400
+
401
+ /*
402
+ * Addresses FF3/4 setting line-height on 'input' using !important in the UA stylesheet
403
+ */
404
+
405
+ button,
406
+ input {
407
+ line-height: normal; /* 1 */
408
+ }
409
+
410
+ /*
411
+ * 1. Improves usability and consistency of cursor style between image-type 'input' and others
412
+ * 2. Corrects inability to style clickable 'input' types in iOS
413
+ * 3. Removes inner spacing in IE7 without affecting normal text inputs
414
+ * Known issue: inner spacing remains in IE6
415
+ */
416
+
417
+ button,
418
+ input[type="button"],
419
+ input[type="reset"],
420
+ input[type="submit"] {
421
+ cursor: pointer; /* 1 */
422
+ -webkit-appearance: button; /* 2 */
423
+ *overflow: visible; /* 3 */
424
+ }
425
+
426
+ /*
427
+ * Re-set default cursor for disabled elements
428
+ */
429
+
430
+ button[disabled],
431
+ input[disabled] {
432
+ cursor: default;
433
+ }
434
+
435
+ /*
436
+ * 1. Addresses box sizing set to content-box in IE8/9
437
+ * 2. Removes excess padding in IE8/9
438
+ * 3. Removes excess padding in IE7
439
+ Known issue: excess padding remains in IE6
440
+ */
441
+
442
+ input[type="checkbox"],
443
+ input[type="radio"] {
444
+ box-sizing: border-box; /* 1 */
445
+ padding: 0; /* 2 */
446
+ *height: 13px; /* 3 */
447
+ *width: 13px; /* 3 */
448
+ }
449
+
450
+ /*
451
+ * 1. Addresses appearance set to searchfield in S5, Chrome
452
+ * 2. Addresses box-sizing set to border-box in S5, Chrome (include -moz to future-proof)
453
+ */
454
+
455
+ input[type="search"] {
456
+ -webkit-appearance: textfield; /* 1 */
457
+ -moz-box-sizing: content-box;
458
+ -webkit-box-sizing: content-box; /* 2 */
459
+ box-sizing: content-box;
460
+ }
461
+
462
+ /*
463
+ * Removes inner padding and search cancel button in S5, Chrome on OS X
464
+ */
465
+
466
+ input[type="search"]::-webkit-search-decoration,
467
+ input[type="search"]::-webkit-search-cancel-button {
468
+ -webkit-appearance: none;
469
+ }
470
+
471
+ /*
472
+ * Removes inner padding and border in FF3+
473
+ * www.sitepen.com/blog/2008/05/14/the-devils-in-the-details-fixing-dojos-toolbar-buttons/
474
+ */
475
+
476
+ button::-moz-focus-inner,
477
+ input::-moz-focus-inner {
478
+ border: 0;
479
+ padding: 0;
480
+ }
481
+
482
+ /*
483
+ * 1. Removes default vertical scrollbar in IE6/7/8/9
484
+ * 2. Improves readability and alignment in all browsers
485
+ */
486
+
487
+ textarea {
488
+ overflow: auto; /* 1 */
489
+ vertical-align: top; /* 2 */
490
+ }
491
+
492
+
493
+ /* =============================================================================
494
+ Tables
495
+ ========================================================================== */
496
+
497
+ /*
498
+ * Remove most spacing between table cells
499
+ */
500
+
501
+ table {
502
+ border-collapse: collapse;
503
+ border-spacing: 0;
504
+ }