railsstrap 3.3.1 → 3.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +13 -27
  3. data/app/helpers/railsstrap/aside_helper.rb +59 -0
  4. data/app/helpers/railsstrap/badge_label_helper.rb +0 -4
  5. data/app/helpers/railsstrap/bootstrap_flash_helper.rb +1 -1
  6. data/app/helpers/railsstrap/date_picker_helper.rb +16 -8
  7. data/app/helpers/railsstrap/modal_helper.rb +18 -24
  8. data/lib/generators/railsstrap/install/templates/bootstrap_and_overrides.less +42 -26
  9. data/lib/railsstrap/constants.rb +1 -1
  10. data/lib/railsstrap/engine.rb +9 -5
  11. data/spec/lib/railsstrap/aside_helper_spec.rb +140 -0
  12. data/spec/lib/railsstrap/badge_label_helper_spec.rb +42 -0
  13. data/spec/lib/railsstrap/bootstrap_flash_helper_spec.rb +130 -0
  14. data/spec/lib/railsstrap/breadcrumbs_spec.rb +75 -0
  15. data/spec/lib/railsstrap/datepicker_helper_spec.rb +59 -0
  16. data/spec/lib/railsstrap/form_errors_helper_spec.rb +147 -0
  17. data/spec/lib/railsstrap/glyph_helper_spec.rb +24 -0
  18. data/spec/lib/railsstrap/icon_helper_spec.rb +24 -0
  19. data/spec/lib/railsstrap/modal_helper_spec.rb +140 -0
  20. data/spec/lib/railsstrap/navbar_helper_spec.rb +373 -0
  21. data/spec/lib/railsstrap/uri_state_spec.rb +49 -0
  22. data/spec/spec_helper.rb +20 -0
  23. data/vendor/assets/bower_components/bootstrap/Gruntfile.js +45 -8
  24. data/vendor/assets/bower_components/bootstrap/LICENSE +1 -1
  25. data/vendor/assets/bower_components/bootstrap/README.md +12 -9
  26. data/vendor/assets/bower_components/bootstrap/bower.json +1 -1
  27. data/vendor/assets/bower_components/bootstrap/dist/css/bootstrap-theme.css +8 -2
  28. data/vendor/assets/bower_components/bootstrap/dist/css/bootstrap-theme.css.map +1 -1
  29. data/vendor/assets/bower_components/bootstrap/dist/css/bootstrap-theme.min.css +3 -3
  30. data/vendor/assets/bower_components/bootstrap/dist/css/bootstrap.css +257 -23
  31. data/vendor/assets/bower_components/bootstrap/dist/css/bootstrap.css.map +1 -1
  32. data/vendor/assets/bower_components/bootstrap/dist/css/bootstrap.min.css +3 -3
  33. data/vendor/assets/bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.eot +0 -0
  34. data/vendor/assets/bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.svg +273 -214
  35. data/vendor/assets/bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf +0 -0
  36. data/vendor/assets/bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.woff +0 -0
  37. data/vendor/assets/bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.woff2 +0 -0
  38. data/vendor/assets/bower_components/bootstrap/dist/js/bootstrap.js +55 -69
  39. data/vendor/assets/bower_components/bootstrap/dist/js/bootstrap.min.js +4 -4
  40. data/vendor/assets/bower_components/bootstrap/fonts/glyphicons-halflings-regular.eot +0 -0
  41. data/vendor/assets/bower_components/bootstrap/fonts/glyphicons-halflings-regular.svg +273 -214
  42. data/vendor/assets/bower_components/bootstrap/fonts/glyphicons-halflings-regular.ttf +0 -0
  43. data/vendor/assets/bower_components/bootstrap/fonts/glyphicons-halflings-regular.woff +0 -0
  44. data/vendor/assets/bower_components/bootstrap/fonts/glyphicons-halflings-regular.woff2 +0 -0
  45. data/vendor/assets/bower_components/bootstrap/grunt/bs-glyphicons-data-generator.js +41 -0
  46. data/vendor/assets/bower_components/bootstrap/grunt/configBridge.json +1 -0
  47. data/vendor/assets/bower_components/bootstrap/grunt/sauce_browsers.yml +4 -4
  48. data/vendor/assets/bower_components/bootstrap/js/affix.js +4 -4
  49. data/vendor/assets/bower_components/bootstrap/js/alert.js +3 -3
  50. data/vendor/assets/bower_components/bootstrap/js/button.js +3 -3
  51. data/vendor/assets/bower_components/bootstrap/js/carousel.js +7 -10
  52. data/vendor/assets/bower_components/bootstrap/js/collapse.js +4 -4
  53. data/vendor/assets/bower_components/bootstrap/js/dropdown.js +3 -3
  54. data/vendor/assets/bower_components/bootstrap/js/modal.js +3 -3
  55. data/vendor/assets/bower_components/bootstrap/js/popover.js +7 -13
  56. data/vendor/assets/bower_components/bootstrap/js/scrollspy.js +3 -3
  57. data/vendor/assets/bower_components/bootstrap/js/tab.js +3 -3
  58. data/vendor/assets/bower_components/bootstrap/js/tooltip.js +10 -16
  59. data/vendor/assets/bower_components/bootstrap/js/transition.js +2 -2
  60. data/vendor/assets/bower_components/bootstrap/less/alerts.less +5 -0
  61. data/vendor/assets/bower_components/bootstrap/less/badges.less +4 -0
  62. data/vendor/assets/bower_components/bootstrap/less/button-groups.less +2 -2
  63. data/vendor/assets/bower_components/bootstrap/less/buttons.less +1 -1
  64. data/vendor/assets/bower_components/bootstrap/less/carousel.less +8 -6
  65. data/vendor/assets/bower_components/bootstrap/less/close.less +1 -0
  66. data/vendor/assets/bower_components/bootstrap/less/dropdowns.less +2 -1
  67. data/vendor/assets/bower_components/bootstrap/less/forms.less +41 -21
  68. data/vendor/assets/bower_components/bootstrap/less/glyphicons.less +67 -0
  69. data/vendor/assets/bower_components/bootstrap/less/jumbotron.less +1 -0
  70. data/vendor/assets/bower_components/bootstrap/less/media.less +14 -0
  71. data/vendor/assets/bower_components/bootstrap/less/mixins/vendor-prefixes.less +1 -1
  72. data/vendor/assets/bower_components/bootstrap/less/navbar.less +1 -0
  73. data/vendor/assets/bower_components/bootstrap/less/panels.less +5 -1
  74. data/vendor/assets/bower_components/bootstrap/less/popovers.less +1 -1
  75. data/vendor/assets/bower_components/bootstrap/less/tables.less +3 -3
  76. data/vendor/assets/bower_components/bootstrap/less/theme.less +3 -2
  77. data/vendor/assets/bower_components/bootstrap/less/tooltip.less +1 -1
  78. data/vendor/assets/bower_components/bootstrap/less/variables.less +3 -2
  79. data/vendor/assets/bower_components/bootstrap/package.json +14 -13
  80. data/vendor/assets/bower_components/jquery/bower.json +2 -2
  81. data/vendor/assets/bower_components/jquery/dist/jquery.js +277 -262
  82. data/vendor/assets/bower_components/jquery/dist/jquery.min.js +4 -4
  83. data/vendor/assets/bower_components/jquery/dist/jquery.min.map +1 -1
  84. data/vendor/assets/bower_components/jquery/src/ajax.js +11 -31
  85. data/vendor/assets/bower_components/jquery/src/ajax/xhr.js +3 -2
  86. data/vendor/assets/bower_components/jquery/src/attributes/attr.js +0 -2
  87. data/vendor/assets/bower_components/jquery/src/attributes/classes.js +4 -4
  88. data/vendor/assets/bower_components/jquery/src/attributes/prop.js +1 -3
  89. data/vendor/assets/bower_components/jquery/src/attributes/support.js +8 -8
  90. data/vendor/assets/bower_components/jquery/src/attributes/val.js +3 -5
  91. data/vendor/assets/bower_components/jquery/src/core.js +6 -7
  92. data/vendor/assets/bower_components/jquery/src/core/init.js +3 -3
  93. data/vendor/assets/bower_components/jquery/src/core/ready.js +1 -1
  94. data/vendor/assets/bower_components/jquery/src/css.js +28 -29
  95. data/vendor/assets/bower_components/jquery/src/css/addGetHookIf.js +2 -4
  96. data/vendor/assets/bower_components/jquery/src/css/curCSS.js +1 -1
  97. data/vendor/assets/bower_components/jquery/src/css/defaultDisplay.js +1 -1
  98. data/vendor/assets/bower_components/jquery/src/css/support.js +5 -0
  99. data/vendor/assets/bower_components/jquery/src/css/var/getStyles.js +8 -1
  100. data/vendor/assets/bower_components/jquery/src/data.js +10 -11
  101. data/vendor/assets/bower_components/jquery/src/data/Data.js +3 -3
  102. data/vendor/assets/bower_components/jquery/src/deferred.js +2 -2
  103. data/vendor/assets/bower_components/jquery/src/dimensions.js +1 -1
  104. data/vendor/assets/bower_components/jquery/src/effects.js +29 -30
  105. data/vendor/assets/bower_components/jquery/src/effects/Tween.js +7 -7
  106. data/vendor/assets/bower_components/jquery/src/event.js +5 -5
  107. data/vendor/assets/bower_components/jquery/src/event/ajax.js +13 -0
  108. data/vendor/assets/bower_components/jquery/src/exports/global.js +2 -2
  109. data/vendor/assets/bower_components/jquery/src/intro.js +8 -8
  110. data/vendor/assets/bower_components/jquery/src/jquery.js +1 -0
  111. data/vendor/assets/bower_components/jquery/src/manipulation.js +9 -11
  112. data/vendor/assets/bower_components/jquery/src/manipulation/support.js +6 -5
  113. data/vendor/assets/bower_components/jquery/src/offset.js +9 -6
  114. data/vendor/assets/bower_components/jquery/src/queue.js +3 -3
  115. data/vendor/assets/bower_components/jquery/src/sizzle/dist/sizzle.js +83 -60
  116. data/vendor/assets/bower_components/jquery/src/sizzle/dist/sizzle.min.js +3 -3
  117. data/vendor/assets/bower_components/jquery/src/sizzle/dist/sizzle.min.map +1 -1
  118. data/vendor/assets/bower_components/jquery/src/traversing.js +3 -4
  119. data/vendor/assets/bower_components/jquery/src/wrap.js +1 -0
  120. data/vendor/assets/stylesheets/aside/aside.less +18 -2
  121. data/vendor/assets/stylesheets/bootstrap.less +2 -0
  122. data/vendor/assets/stylesheets/dist/railsstrap.css +28 -6
  123. data/vendor/assets/stylesheets/fontawesome-local.less +15 -0
  124. data/vendor/assets/stylesheets/glyphicons.less +12 -0
  125. metadata +278 -7
@@ -15,13 +15,13 @@
15
15
  (function( global, factory ) {
16
16
 
17
17
  if ( typeof module === "object" && typeof module.exports === "object" ) {
18
- // For CommonJS and CommonJS-like environments where a proper window is present,
19
- // execute the factory and get jQuery
20
- // For environments that do not inherently posses a window with a document
21
- // (such as Node.js), expose a jQuery-making factory as module.exports
22
- // This accentuates the need for the creation of a real window
18
+ // For CommonJS and CommonJS-like environments where a proper `window`
19
+ // is present, execute the factory and get jQuery.
20
+ // For environments that do not have a `window` with a `document`
21
+ // (such as Node.js), expose a factory as module.exports.
22
+ // This accentuates the need for the creation of a real `window`.
23
23
  // e.g. var jQuery = require("jquery")(window);
24
- // See ticket #14549 for more info
24
+ // See ticket #14549 for more info.
25
25
  module.exports = global.document ?
26
26
  factory( global, true ) :
27
27
  function( w ) {
@@ -37,8 +37,8 @@
37
37
  // Pass this if window is not defined yet
38
38
  }(typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
39
39
 
40
- // Can't do this because several apps including ASP.NET trace
40
+ // Support: Firefox 18+
41
+ // Can't be in strict mode, several libs including ASP.NET trace
41
42
  // the stack via arguments.caller.callee and Firefox dies if
42
43
  // you try to trace through "use strict" call chains. (#13335)
43
- // Support: Firefox 18+
44
44
  //"use strict";
@@ -22,6 +22,7 @@ define([
22
22
  "./ajax/script",
23
23
  "./ajax/jsonp",
24
24
  "./ajax/load",
25
+ "./event/ajax",
25
26
  "./effects",
26
27
  "./effects/animatedSelector",
27
28
  "./offset",
@@ -29,7 +29,7 @@ var
29
29
  // We have to close these tags to support XHTML (#13200)
30
30
  wrapMap = {
31
31
 
32
- // Support: IE 9
32
+ // Support: IE9
33
33
  option: [ 1, "<select multiple='multiple'>", "</select>" ],
34
34
 
35
35
  thead: [ 1, "<table>", "</table>" ],
@@ -40,7 +40,7 @@ var
40
40
  _default: [ 0, "", "" ]
41
41
  };
42
42
 
43
- // Support: IE 9
43
+ // Support: IE9
44
44
  wrapMap.optgroup = wrapMap.option;
45
45
 
46
46
  wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
@@ -130,7 +130,7 @@ function getAll( context, tag ) {
130
130
  ret;
131
131
  }
132
132
 
133
- // Support: IE >= 9
133
+ // Fix IE bugs, see support tests
134
134
  function fixInput( src, dest ) {
135
135
  var nodeName = dest.nodeName.toLowerCase();
136
136
 
@@ -150,8 +150,7 @@ jQuery.extend({
150
150
  clone = elem.cloneNode( true ),
151
151
  inPage = jQuery.contains( elem.ownerDocument, elem );
152
152
 
153
- // Support: IE >= 9
154
- // Fix Cloning issues
153
+ // Fix IE cloning issues
155
154
  if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
156
155
  !jQuery.isXMLDoc( elem ) ) {
157
156
 
@@ -202,8 +201,8 @@ jQuery.extend({
202
201
 
203
202
  // Add nodes directly
204
203
  if ( jQuery.type( elem ) === "object" ) {
205
- // Support: QtWebKit
206
- // jQuery.merge because push.apply(_, arraylike) throws
204
+ // Support: QtWebKit, PhantomJS
205
+ // push.apply(_, arraylike) throws on ancient WebKit
207
206
  jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
208
207
 
209
208
  // Convert non-html into a text node
@@ -225,15 +224,14 @@ jQuery.extend({
225
224
  tmp = tmp.lastChild;
226
225
  }
227
226
 
228
- // Support: QtWebKit
229
- // jQuery.merge because push.apply(_, arraylike) throws
227
+ // Support: QtWebKit, PhantomJS
228
+ // push.apply(_, arraylike) throws on ancient WebKit
230
229
  jQuery.merge( nodes, tmp.childNodes );
231
230
 
232
231
  // Remember the top-level container
233
232
  tmp = fragment.firstChild;
234
233
 
235
- // Fixes #12346
236
- // Support: Webkit, IE
234
+ // Ensure the created nodes are orphaned (#12392)
237
235
  tmp.textContent = "";
238
236
  }
239
237
  }
@@ -7,21 +7,22 @@ define([
7
7
  div = fragment.appendChild( document.createElement( "div" ) ),
8
8
  input = document.createElement( "input" );
9
9
 
10
- // #11217 - WebKit loses check when the name is after the checked attribute
10
+ // Support: Safari<=5.1
11
+ // Check state lost if the name is set (#11217)
11
12
  // Support: Windows Web Apps (WWA)
12
- // `name` and `type` need .setAttribute for WWA
13
+ // `name` and `type` must use .setAttribute for WWA (#14901)
13
14
  input.setAttribute( "type", "radio" );
14
15
  input.setAttribute( "checked", "checked" );
15
16
  input.setAttribute( "name", "t" );
16
17
 
17
18
  div.appendChild( input );
18
19
 
19
- // Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3
20
- // old WebKit doesn't clone checked state correctly in fragments
20
+ // Support: Safari<=5.1, Android<4.2
21
+ // Older WebKit doesn't clone checked state correctly in fragments
21
22
  support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
22
23
 
24
+ // Support: IE<=11+
23
25
  // Make sure textarea (and checkbox) defaultValue is properly cloned
24
- // Support: IE9-IE11+
25
26
  div.innerHTML = "<textarea>x</textarea>";
26
27
  support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
27
28
  })();
@@ -39,7 +39,8 @@ jQuery.offset = {
39
39
  calculatePosition = ( position === "absolute" || position === "fixed" ) &&
40
40
  ( curCSSTop + curCSSLeft ).indexOf("auto") > -1;
41
41
 
42
- // Need to be able to calculate position if either top or left is auto and position is either absolute or fixed
42
+ // Need to be able to calculate position if either
43
+ // top or left is auto and position is either absolute or fixed
43
44
  if ( calculatePosition ) {
44
45
  curPosition = curElem.position();
45
46
  curTop = curPosition.top;
@@ -96,8 +97,8 @@ jQuery.fn.extend({
96
97
  return box;
97
98
  }
98
99
 
100
+ // Support: BlackBerry 5, iOS 3 (original iPhone)
99
101
  // If we don't have gBCR, just use 0,0 rather than error
100
- // BlackBerry 5, iOS 3 (original iPhone)
101
102
  if ( typeof elem.getBoundingClientRect !== strundefined ) {
102
103
  box = elem.getBoundingClientRect();
103
104
  }
@@ -119,7 +120,7 @@ jQuery.fn.extend({
119
120
 
120
121
  // Fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is its only offset parent
121
122
  if ( jQuery.css( elem, "position" ) === "fixed" ) {
122
- // We assume that getBoundingClientRect is available when computed position is fixed
123
+ // Assume getBoundingClientRect is there when computed position is fixed
123
124
  offset = elem.getBoundingClientRect();
124
125
 
125
126
  } else {
@@ -182,16 +183,18 @@ jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function(
182
183
  };
183
184
  });
184
185
 
186
+ // Support: Safari<7+, Chrome<37+
185
187
  // Add the top/left cssHooks using jQuery.fn.position
186
188
  // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
187
- // getComputedStyle returns percent when specified for top/left/bottom/right
188
- // rather than make the css module depend on the offset module, we just check for it here
189
+ // Blink bug: https://code.google.com/p/chromium/issues/detail?id=229280
190
+ // getComputedStyle returns percent when specified for top/left/bottom/right;
191
+ // rather than make the css module depend on the offset module, just check for it here
189
192
  jQuery.each( [ "top", "left" ], function( i, prop ) {
190
193
  jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
191
194
  function( elem, computed ) {
192
195
  if ( computed ) {
193
196
  computed = curCSS( elem, prop );
194
- // if curCSS returns percentage, fallback to offset
197
+ // If curCSS returns percentage, fallback to offset
195
198
  return rnumnonpx.test( computed ) ?
196
199
  jQuery( elem ).position()[ prop ] + "px" :
197
200
  computed;
@@ -50,7 +50,7 @@ jQuery.extend({
50
50
  queue.unshift( "inprogress" );
51
51
  }
52
52
 
53
- // clear up the last queue stop function
53
+ // Clear up the last queue stop function
54
54
  delete hooks.stop;
55
55
  fn.call( elem, next, hooks );
56
56
  }
@@ -60,7 +60,7 @@ jQuery.extend({
60
60
  }
61
61
  },
62
62
 
63
- // not intended for public consumption - generates a queueHooks object, or returns the current one
63
+ // Not public - generate a queueHooks object, or return the current one
64
64
  _queueHooks: function( elem, type ) {
65
65
  var key = type + "queueHooks";
66
66
  return data_priv.get( elem, key ) || data_priv.access( elem, key, {
@@ -90,7 +90,7 @@ jQuery.fn.extend({
90
90
  this.each(function() {
91
91
  var queue = jQuery.queue( this, type, data );
92
92
 
93
- // ensure a hooks for this queue
93
+ // Ensure a hooks for this queue
94
94
  jQuery._queueHooks( this, type );
95
95
 
96
96
  if ( type === "fx" && queue[0] !== "inprogress" ) {
@@ -1,12 +1,12 @@
1
1
  /*!
2
- * Sizzle CSS Selector Engine v1.10.19
2
+ * Sizzle CSS Selector Engine v2.2.0-pre
3
3
  * http://sizzlejs.com/
4
4
  *
5
- * Copyright 2013 jQuery Foundation, Inc. and other contributors
5
+ * Copyright 2008, 2014 jQuery Foundation, Inc. and other contributors
6
6
  * Released under the MIT license
7
7
  * http://jquery.org/license
8
8
  *
9
- * Date: 2014-04-18
9
+ * Date: 2014-12-16
10
10
  */
11
11
  (function( window ) {
12
12
 
@@ -33,7 +33,7 @@ var i,
33
33
  contains,
34
34
 
35
35
  // Instance-specific data
36
- expando = "sizzle" + -(new Date()),
36
+ expando = "sizzle" + 1 * new Date(),
37
37
  preferredDoc = window.document,
38
38
  dirruns = 0,
39
39
  done = 0,
@@ -48,7 +48,6 @@ var i,
48
48
  },
49
49
 
50
50
  // General-purpose constants
51
- strundefined = typeof undefined,
52
51
  MAX_NEGATIVE = 1 << 31,
53
52
 
54
53
  // Instance methods
@@ -58,12 +57,13 @@ var i,
58
57
  push_native = arr.push,
59
58
  push = arr.push,
60
59
  slice = arr.slice,
61
- // Use a stripped-down indexOf if we can't use a native one
62
- indexOf = arr.indexOf || function( elem ) {
60
+ // Use a stripped-down indexOf as it's faster than native
61
+ // http://jsperf.com/thor-indexof-vs-for/5
62
+ indexOf = function( list, elem ) {
63
63
  var i = 0,
64
- len = this.length;
64
+ len = list.length;
65
65
  for ( ; i < len; i++ ) {
66
- if ( this[i] === elem ) {
66
+ if ( list[i] === elem ) {
67
67
  return i;
68
68
  }
69
69
  }
@@ -103,6 +103,7 @@ var i,
103
103
  ")\\)|)",
104
104
 
105
105
  // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
106
+ rwhitespace = new RegExp( whitespace + "+", "g" ),
106
107
  rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
107
108
 
108
109
  rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
@@ -154,6 +155,14 @@ var i,
154
155
  String.fromCharCode( high + 0x10000 ) :
155
156
  // Supplemental Plane codepoint (surrogate pair)
156
157
  String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
158
+ },
159
+
160
+ // Used for iframes
161
+ // See setDocument()
162
+ // Removing the function wrapper causes a "Permission Denied"
163
+ // error in IE
164
+ unloadHandler = function() {
165
+ setDocument();
157
166
  };
158
167
 
159
168
  // Optimize for push.apply( _, NodeList )
@@ -196,19 +205,18 @@ function Sizzle( selector, context, results, seed ) {
196
205
 
197
206
  context = context || document;
198
207
  results = results || [];
208
+ nodeType = context.nodeType;
199
209
 
200
- if ( !selector || typeof selector !== "string" ) {
201
- return results;
202
- }
210
+ if ( typeof selector !== "string" || !selector ||
211
+ nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
203
212
 
204
- if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) {
205
- return [];
213
+ return results;
206
214
  }
207
215
 
208
- if ( documentIsHTML && !seed ) {
216
+ if ( !seed && documentIsHTML ) {
209
217
 
210
- // Shortcuts
211
- if ( (match = rquickExpr.exec( selector )) ) {
218
+ // Try to shortcut find operations when possible (e.g., not under DocumentFragment)
219
+ if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
212
220
  // Speed-up: Sizzle("#ID")
213
221
  if ( (m = match[1]) ) {
214
222
  if ( nodeType === 9 ) {
@@ -240,7 +248,7 @@ function Sizzle( selector, context, results, seed ) {
240
248
  return results;
241
249
 
242
250
  // Speed-up: Sizzle(".CLASS")
243
- } else if ( (m = match[3]) && support.getElementsByClassName && context.getElementsByClassName ) {
251
+ } else if ( (m = match[3]) && support.getElementsByClassName ) {
244
252
  push.apply( results, context.getElementsByClassName( m ) );
245
253
  return results;
246
254
  }
@@ -250,7 +258,7 @@ function Sizzle( selector, context, results, seed ) {
250
258
  if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
251
259
  nid = old = expando;
252
260
  newContext = context;
253
- newSelector = nodeType === 9 && selector;
261
+ newSelector = nodeType !== 1 && selector;
254
262
 
255
263
  // qSA works strangely on Element-rooted queries
256
264
  // We can work around this by specifying an extra ID on the root
@@ -437,7 +445,7 @@ function createPositionalPseudo( fn ) {
437
445
  * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
438
446
  */
439
447
  function testContext( context ) {
440
- return context && typeof context.getElementsByTagName !== strundefined && context;
448
+ return context && typeof context.getElementsByTagName !== "undefined" && context;
441
449
  }
442
450
 
443
451
  // Expose support vars for convenience
@@ -461,9 +469,8 @@ isXML = Sizzle.isXML = function( elem ) {
461
469
  * @returns {Object} Returns the current document
462
470
  */
463
471
  setDocument = Sizzle.setDocument = function( node ) {
464
- var hasCompare,
465
- doc = node ? node.ownerDocument || node : preferredDoc,
466
- parent = doc.defaultView;
472
+ var hasCompare, parent,
473
+ doc = node ? node.ownerDocument || node : preferredDoc;
467
474
 
468
475
  // If no document and documentElement is available, return
469
476
  if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
@@ -473,9 +480,7 @@ setDocument = Sizzle.setDocument = function( node ) {
473
480
  // Set our document
474
481
  document = doc;
475
482
  docElem = doc.documentElement;
476
-
477
- // Support tests
478
- documentIsHTML = !isXML( doc );
483
+ parent = doc.defaultView;
479
484
 
480
485
  // Support: IE>8
481
486
  // If iframe document is assigned to "document" variable and if iframe has been reloaded,
@@ -484,21 +489,22 @@ setDocument = Sizzle.setDocument = function( node ) {
484
489
  if ( parent && parent !== parent.top ) {
485
490
  // IE11 does not have attachEvent, so all must suffer
486
491
  if ( parent.addEventListener ) {
487
- parent.addEventListener( "unload", function() {
488
- setDocument();
489
- }, false );
492
+ parent.addEventListener( "unload", unloadHandler, false );
490
493
  } else if ( parent.attachEvent ) {
491
- parent.attachEvent( "onunload", function() {
492
- setDocument();
493
- });
494
+ parent.attachEvent( "onunload", unloadHandler );
494
495
  }
495
496
  }
496
497
 
498
+ /* Support tests
499
+ ---------------------------------------------------------------------- */
500
+ documentIsHTML = !isXML( doc );
501
+
497
502
  /* Attributes
498
503
  ---------------------------------------------------------------------- */
499
504
 
500
505
  // Support: IE<8
501
- // Verify that getAttribute really returns attributes and not properties (excepting IE8 booleans)
506
+ // Verify that getAttribute really returns attributes and not properties
507
+ // (excepting IE8 booleans)
502
508
  support.attributes = assert(function( div ) {
503
509
  div.className = "i";
504
510
  return !div.getAttribute("className");
@@ -513,17 +519,8 @@ setDocument = Sizzle.setDocument = function( node ) {
513
519
  return !div.getElementsByTagName("*").length;
514
520
  });
515
521
 
516
- // Check if getElementsByClassName can be trusted
517
- support.getElementsByClassName = rnative.test( doc.getElementsByClassName ) && assert(function( div ) {
518
- div.innerHTML = "<div class='a'></div><div class='a i'></div>";
519
-
520
- // Support: Safari<4
521
- // Catch class over-caching
522
- div.firstChild.className = "i";
523
- // Support: Opera<10
524
- // Catch gEBCN failure to find non-leading classes
525
- return div.getElementsByClassName("i").length === 2;
526
- });
522
+ // Support: IE<9
523
+ support.getElementsByClassName = rnative.test( doc.getElementsByClassName );
527
524
 
528
525
  // Support: IE<10
529
526
  // Check if getElementById returns elements by name
@@ -537,7 +534,7 @@ setDocument = Sizzle.setDocument = function( node ) {
537
534
  // ID find and filter
538
535
  if ( support.getById ) {
539
536
  Expr.find["ID"] = function( id, context ) {
540
- if ( typeof context.getElementById !== strundefined && documentIsHTML ) {
537
+ if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
541
538
  var m = context.getElementById( id );
542
539
  // Check parentNode to catch when Blackberry 4.6 returns
543
540
  // nodes that are no longer in the document #6963
@@ -558,7 +555,7 @@ setDocument = Sizzle.setDocument = function( node ) {
558
555
  Expr.filter["ID"] = function( id ) {
559
556
  var attrId = id.replace( runescape, funescape );
560
557
  return function( elem ) {
561
- var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id");
558
+ var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
562
559
  return node && node.value === attrId;
563
560
  };
564
561
  };
@@ -567,14 +564,20 @@ setDocument = Sizzle.setDocument = function( node ) {
567
564
  // Tag
568
565
  Expr.find["TAG"] = support.getElementsByTagName ?
569
566
  function( tag, context ) {
570
- if ( typeof context.getElementsByTagName !== strundefined ) {
567
+ if ( typeof context.getElementsByTagName !== "undefined" ) {
571
568
  return context.getElementsByTagName( tag );
569
+
570
+ // DocumentFragment nodes don't have gEBTN
571
+ } else if ( support.qsa ) {
572
+ return context.querySelectorAll( tag );
572
573
  }
573
574
  } :
575
+
574
576
  function( tag, context ) {
575
577
  var elem,
576
578
  tmp = [],
577
579
  i = 0,
580
+ // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
578
581
  results = context.getElementsByTagName( tag );
579
582
 
580
583
  // Filter out possible comments
@@ -592,7 +595,7 @@ setDocument = Sizzle.setDocument = function( node ) {
592
595
 
593
596
  // Class
594
597
  Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
595
- if ( typeof context.getElementsByClassName !== strundefined && documentIsHTML ) {
598
+ if ( documentIsHTML ) {
596
599
  return context.getElementsByClassName( className );
597
600
  }
598
601
  };
@@ -621,13 +624,15 @@ setDocument = Sizzle.setDocument = function( node ) {
621
624
  // setting a boolean content attribute,
622
625
  // since its presence should be enough
623
626
  // http://bugs.jquery.com/ticket/12359
624
- div.innerHTML = "<select msallowclip=''><option selected=''></option></select>";
627
+ docElem.appendChild( div ).innerHTML = "<a id='" + expando + "'></a>" +
628
+ "<select id='" + expando + "-\f]' msallowcapture=''>" +
629
+ "<option selected=''></option></select>";
625
630
 
626
631
  // Support: IE8, Opera 11-12.16
627
632
  // Nothing should be selected when empty strings follow ^= or $= or *=
628
633
  // The test attribute must be unknown in Opera but "safe" for WinRT
629
634
  // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
630
- if ( div.querySelectorAll("[msallowclip^='']").length ) {
635
+ if ( div.querySelectorAll("[msallowcapture^='']").length ) {
631
636
  rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
632
637
  }
633
638
 
@@ -637,12 +642,24 @@ setDocument = Sizzle.setDocument = function( node ) {
637
642
  rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
638
643
  }
639
644
 
645
+ // Support: Chrome<29, Android<4.2+, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.7+
646
+ if ( !div.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
647
+ rbuggyQSA.push("~=");
648
+ }
649
+
640
650
  // Webkit/Opera - :checked should return selected option elements
641
651
  // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
642
652
  // IE8 throws error here and will not see later tests
643
653
  if ( !div.querySelectorAll(":checked").length ) {
644
654
  rbuggyQSA.push(":checked");
645
655
  }
656
+
657
+ // Support: Safari 8+, iOS 8+
658
+ // https://bugs.webkit.org/show_bug.cgi?id=136851
659
+ // In-page `selector#id sibing-combinator selector` fails
660
+ if ( !div.querySelectorAll( "a#" + expando + "+*" ).length ) {
661
+ rbuggyQSA.push(".#.+[+~]");
662
+ }
646
663
  });
647
664
 
648
665
  assert(function( div ) {
@@ -759,7 +776,7 @@ setDocument = Sizzle.setDocument = function( node ) {
759
776
 
760
777
  // Maintain original order
761
778
  return sortInput ?
762
- ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
779
+ ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
763
780
  0;
764
781
  }
765
782
 
@@ -786,7 +803,7 @@ setDocument = Sizzle.setDocument = function( node ) {
786
803
  aup ? -1 :
787
804
  bup ? 1 :
788
805
  sortInput ?
789
- ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
806
+ ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
790
807
  0;
791
808
 
792
809
  // If the nodes are siblings, we can do a quick check
@@ -849,7 +866,7 @@ Sizzle.matchesSelector = function( elem, expr ) {
849
866
  elem.document && elem.document.nodeType !== 11 ) {
850
867
  return ret;
851
868
  }
852
- } catch(e) {}
869
+ } catch (e) {}
853
870
  }
854
871
 
855
872
  return Sizzle( expr, document, null, [ elem ] ).length > 0;
@@ -1068,7 +1085,7 @@ Expr = Sizzle.selectors = {
1068
1085
  return pattern ||
1069
1086
  (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
1070
1087
  classCache( className, function( elem ) {
1071
- return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute("class") || "" );
1088
+ return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
1072
1089
  });
1073
1090
  },
1074
1091
 
@@ -1090,7 +1107,7 @@ Expr = Sizzle.selectors = {
1090
1107
  operator === "^=" ? check && result.indexOf( check ) === 0 :
1091
1108
  operator === "*=" ? check && result.indexOf( check ) > -1 :
1092
1109
  operator === "$=" ? check && result.slice( -check.length ) === check :
1093
- operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 :
1110
+ operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
1094
1111
  operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
1095
1112
  false;
1096
1113
  };
@@ -1210,7 +1227,7 @@ Expr = Sizzle.selectors = {
1210
1227
  matched = fn( seed, argument ),
1211
1228
  i = matched.length;
1212
1229
  while ( i-- ) {
1213
- idx = indexOf.call( seed, matched[i] );
1230
+ idx = indexOf( seed, matched[i] );
1214
1231
  seed[ idx ] = !( matches[ idx ] = matched[i] );
1215
1232
  }
1216
1233
  }) :
@@ -1249,6 +1266,8 @@ Expr = Sizzle.selectors = {
1249
1266
  function( elem, context, xml ) {
1250
1267
  input[0] = elem;
1251
1268
  matcher( input, null, xml, results );
1269
+ // Don't keep the element (issue #299)
1270
+ input[0] = null;
1252
1271
  return !results.pop();
1253
1272
  };
1254
1273
  }),
@@ -1260,6 +1279,7 @@ Expr = Sizzle.selectors = {
1260
1279
  }),
1261
1280
 
1262
1281
  "contains": markFunction(function( text ) {
1282
+ text = text.replace( runescape, funescape );
1263
1283
  return function( elem ) {
1264
1284
  return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
1265
1285
  };
@@ -1681,7 +1701,7 @@ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postS
1681
1701
  i = matcherOut.length;
1682
1702
  while ( i-- ) {
1683
1703
  if ( (elem = matcherOut[i]) &&
1684
- (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) {
1704
+ (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
1685
1705
 
1686
1706
  seed[temp] = !(results[temp] = elem);
1687
1707
  }
@@ -1716,13 +1736,16 @@ function matcherFromTokens( tokens ) {
1716
1736
  return elem === checkContext;
1717
1737
  }, implicitRelative, true ),
1718
1738
  matchAnyContext = addCombinator( function( elem ) {
1719
- return indexOf.call( checkContext, elem ) > -1;
1739
+ return indexOf( checkContext, elem ) > -1;
1720
1740
  }, implicitRelative, true ),
1721
1741
  matchers = [ function( elem, context, xml ) {
1722
- return ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
1742
+ var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
1723
1743
  (checkContext = context).nodeType ?
1724
1744
  matchContext( elem, context, xml ) :
1725
1745
  matchAnyContext( elem, context, xml ) );
1746
+ // Avoid hanging onto element (issue #299)
1747
+ checkContext = null;
1748
+ return ret;
1726
1749
  } ];
1727
1750
 
1728
1751
  for ( ; i < len; i++ ) {
@@ -1972,7 +1995,7 @@ select = Sizzle.select = function( selector, context, results, seed ) {
1972
1995
  // Sort stability
1973
1996
  support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
1974
1997
 
1975
- // Support: Chrome<14
1998
+ // Support: Chrome 14-35+
1976
1999
  // Always assume duplicates if they aren't passed to the comparison function
1977
2000
  support.detectDuplicates = !!hasDuplicate;
1978
2001