epuber 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (207) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +5 -3
  3. data/README.md +3 -11
  4. data/bin/epuber +2 -3
  5. data/epuber.gemspec +3 -6
  6. data/lib/epuber/book/contributor.rb +1 -1
  7. data/lib/epuber/book/file_request.rb +1 -1
  8. data/lib/epuber/book/target.rb +1 -2
  9. data/lib/epuber/book/toc_item.rb +1 -2
  10. data/lib/epuber/book.rb +1 -2
  11. data/lib/epuber/checker/text_checker.rb +1 -1
  12. data/lib/epuber/checker.rb +1 -2
  13. data/lib/epuber/checker_transformer_base.rb +1 -0
  14. data/lib/epuber/command/build.rb +1 -2
  15. data/lib/epuber/command/compile.rb +1 -1
  16. data/lib/epuber/command/init.rb +1 -2
  17. data/lib/epuber/command/server.rb +1 -2
  18. data/lib/epuber/command.rb +1 -1
  19. data/lib/epuber/compiler/compilation_context.rb +1 -1
  20. data/lib/epuber/compiler/file_database.rb +3 -5
  21. data/lib/epuber/compiler/file_finders/abstract.rb +1 -1
  22. data/lib/epuber/compiler/file_finders/imaginary.rb +1 -2
  23. data/lib/epuber/compiler/file_finders/normal.rb +1 -1
  24. data/lib/epuber/compiler/file_resolver.rb +1 -1
  25. data/lib/epuber/compiler/file_stat.rb +0 -1
  26. data/lib/epuber/compiler/file_types/abstract_file.rb +1 -2
  27. data/lib/epuber/compiler/file_types/bade_file.rb +1 -2
  28. data/lib/epuber/compiler/file_types/coffee_script_file.rb +1 -2
  29. data/lib/epuber/compiler/file_types/container_xml_file.rb +1 -2
  30. data/lib/epuber/compiler/file_types/generated_file.rb +1 -2
  31. data/lib/epuber/compiler/file_types/ibooks_display_options_file.rb +1 -7
  32. data/lib/epuber/compiler/file_types/image_file.rb +1 -2
  33. data/lib/epuber/compiler/file_types/mime_type_file.rb +1 -2
  34. data/lib/epuber/compiler/file_types/nav_file.rb +1 -2
  35. data/lib/epuber/compiler/file_types/opf_file.rb +1 -2
  36. data/lib/epuber/compiler/file_types/source_file.rb +1 -2
  37. data/lib/epuber/compiler/file_types/static_file.rb +1 -2
  38. data/lib/epuber/compiler/file_types/stylus_file.rb +1 -2
  39. data/lib/epuber/compiler/file_types/xhtml_file.rb +2 -4
  40. data/lib/epuber/compiler/generator.rb +1 -1
  41. data/lib/epuber/compiler/meta_inf_generator.rb +1 -1
  42. data/lib/epuber/compiler/nav_generator.rb +1 -1
  43. data/lib/epuber/compiler/opf_generator.rb +1 -1
  44. data/lib/epuber/compiler/problem.rb +1 -2
  45. data/lib/epuber/compiler/xhtml_processor.rb +3 -1
  46. data/lib/epuber/compiler.rb +7 -11
  47. data/lib/epuber/config.rb +1 -2
  48. data/lib/epuber/dsl/attribute.rb +1 -1
  49. data/lib/epuber/dsl/attribute_support.rb +2 -2
  50. data/lib/epuber/dsl/object.rb +1 -1
  51. data/lib/epuber/dsl/tree_object.rb +1 -1
  52. data/lib/epuber/helper.rb +1 -1
  53. data/lib/epuber/lockfile.rb +1 -1
  54. data/lib/epuber/plugin.rb +1 -1
  55. data/lib/epuber/ruby_extensions/match_data.rb +1 -0
  56. data/lib/epuber/ruby_extensions/thread.rb +1 -0
  57. data/lib/epuber/server/handlers.rb +1 -1
  58. data/lib/epuber/server.rb +2 -2
  59. data/lib/epuber/templates.rb +2 -1
  60. data/lib/epuber/third_party/bower/bower.json +3 -3
  61. data/lib/epuber/third_party/bower/bower_components/cookies-js/bower.json +1 -1
  62. data/lib/epuber/third_party/bower/bower_components/cookies-js/dist/cookies.js +2 -3
  63. data/lib/epuber/third_party/bower/bower_components/cookies-js/dist/cookies.min.js +6 -6
  64. data/lib/epuber/third_party/bower/bower_components/jquery/AUTHORS.txt +278 -0
  65. data/lib/epuber/third_party/bower/bower_components/jquery/{MIT-LICENSE.txt → LICENSE.txt} +17 -2
  66. data/lib/epuber/third_party/bower/bower_components/jquery/README.md +65 -0
  67. data/lib/epuber/third_party/bower/bower_components/jquery/bower.json +2 -16
  68. data/lib/epuber/third_party/bower/bower_components/jquery/dist/jquery.js +2566 -1962
  69. data/lib/epuber/third_party/bower/bower_components/jquery/dist/jquery.min.js +4 -5
  70. data/lib/epuber/third_party/bower/bower_components/jquery/dist/jquery.min.map +1 -1
  71. data/lib/epuber/third_party/bower/bower_components/jquery/external/sizzle/LICENSE.txt +36 -0
  72. data/lib/epuber/third_party/bower/bower_components/jquery/{src → external}/sizzle/dist/sizzle.js +236 -160
  73. data/lib/epuber/third_party/bower/bower_components/jquery/external/sizzle/dist/sizzle.min.js +3 -0
  74. data/lib/epuber/third_party/bower/bower_components/jquery/external/sizzle/dist/sizzle.min.map +1 -0
  75. data/lib/epuber/third_party/bower/bower_components/jquery/src/ajax/jsonp.js +25 -14
  76. data/lib/epuber/third_party/bower/bower_components/jquery/src/ajax/load.js +20 -12
  77. data/lib/epuber/third_party/bower/bower_components/jquery/src/ajax/parseJSON.js +2 -2
  78. data/lib/epuber/third_party/bower/bower_components/jquery/src/ajax/parseXML.js +4 -5
  79. data/lib/epuber/third_party/bower/bower_components/jquery/src/ajax/script.js +16 -12
  80. data/lib/epuber/third_party/bower/bower_components/jquery/src/ajax/var/location.js +3 -0
  81. data/lib/epuber/third_party/bower/bower_components/jquery/src/ajax/var/nonce.js +2 -2
  82. data/lib/epuber/third_party/bower/bower_components/jquery/src/ajax/var/rquery.js +3 -3
  83. data/lib/epuber/third_party/bower/bower_components/jquery/src/ajax/xhr.js +73 -42
  84. data/lib/epuber/third_party/bower/bower_components/jquery/src/ajax.js +116 -57
  85. data/lib/epuber/third_party/bower/bower_components/jquery/src/attributes/attr.js +49 -48
  86. data/lib/epuber/third_party/bower/bower_components/jquery/src/attributes/classes.js +86 -67
  87. data/lib/epuber/third_party/bower/bower_components/jquery/src/attributes/prop.js +63 -32
  88. data/lib/epuber/third_party/bower/bower_components/jquery/src/attributes/support.js +6 -5
  89. data/lib/epuber/third_party/bower/bower_components/jquery/src/attributes/val.js +40 -24
  90. data/lib/epuber/third_party/bower/bower_components/jquery/src/attributes.js +2 -2
  91. data/lib/epuber/third_party/bower/bower_components/jquery/src/callbacks.js +114 -87
  92. data/lib/epuber/third_party/bower/bower_components/jquery/src/core/access.js +11 -6
  93. data/lib/epuber/third_party/bower/bower_components/jquery/src/core/init.js +27 -16
  94. data/lib/epuber/third_party/bower/bower_components/jquery/src/core/parseHTML.js +10 -8
  95. data/lib/epuber/third_party/bower/bower_components/jquery/src/core/ready.js +20 -14
  96. data/lib/epuber/third_party/bower/bower_components/jquery/src/core/var/rsingleTag.js +4 -3
  97. data/lib/epuber/third_party/bower/bower_components/jquery/src/core.js +77 -85
  98. data/lib/epuber/third_party/bower/bower_components/jquery/src/css/addGetHookIf.js +5 -3
  99. data/lib/epuber/third_party/bower/bower_components/jquery/src/css/adjustCSS.js +65 -0
  100. data/lib/epuber/third_party/bower/bower_components/jquery/src/css/curCSS.js +20 -17
  101. data/lib/epuber/third_party/bower/bower_components/jquery/src/css/defaultDisplay.js +16 -14
  102. data/lib/epuber/third_party/bower/bower_components/jquery/src/css/hiddenVisibleSelectors.js +9 -6
  103. data/lib/epuber/third_party/bower/bower_components/jquery/src/css/showHide.js +48 -0
  104. data/lib/epuber/third_party/bower/bower_components/jquery/src/css/support.js +86 -61
  105. data/lib/epuber/third_party/bower/bower_components/jquery/src/css/var/cssExpand.js +2 -2
  106. data/lib/epuber/third_party/bower/bower_components/jquery/src/css/var/getStyles.js +8 -5
  107. data/lib/epuber/third_party/bower/bower_components/jquery/src/css/var/isHidden.js +6 -3
  108. data/lib/epuber/third_party/bower/bower_components/jquery/src/css/var/rmargin.js +3 -3
  109. data/lib/epuber/third_party/bower/bower_components/jquery/src/css/var/rnumnonpx.js +2 -2
  110. data/lib/epuber/third_party/bower/bower_components/jquery/src/css/{swap.js → var/swap.js} +3 -7
  111. data/lib/epuber/third_party/bower/bower_components/jquery/src/css.js +107 -55
  112. data/lib/epuber/third_party/bower/bower_components/jquery/src/data/Data.js +93 -74
  113. data/lib/epuber/third_party/bower/bower_components/jquery/src/data/{accepts.js → var/acceptData.js} +4 -6
  114. data/lib/epuber/third_party/bower/bower_components/jquery/src/data/var/{data_user.js → dataPriv.js} +2 -2
  115. data/lib/epuber/third_party/bower/bower_components/jquery/src/data/var/{data_priv.js → dataUser.js} +2 -2
  116. data/lib/epuber/third_party/bower/bower_components/jquery/src/data.js +49 -40
  117. data/lib/epuber/third_party/bower/bower_components/jquery/src/deferred.js +34 -25
  118. data/lib/epuber/third_party/bower/bower_components/jquery/src/deprecated.js +27 -8
  119. data/lib/epuber/third_party/bower/bower_components/jquery/src/dimensions.js +9 -5
  120. data/lib/epuber/third_party/bower/bower_components/jquery/src/effects/Tween.js +14 -7
  121. data/lib/epuber/third_party/bower/bower_components/jquery/src/effects/animatedSelector.js +4 -4
  122. data/lib/epuber/third_party/bower/bower_components/jquery/src/effects.js +96 -115
  123. data/lib/epuber/third_party/bower/bower_components/jquery/src/event/ajax.js +11 -4
  124. data/lib/epuber/third_party/bower/bower_components/jquery/src/event/alias.js +11 -23
  125. data/lib/epuber/third_party/bower/bower_components/jquery/src/event/focusin.js +53 -0
  126. data/lib/epuber/third_party/bower/bower_components/jquery/src/event/support.js +3 -3
  127. data/lib/epuber/third_party/bower/bower_components/jquery/src/event/trigger.js +183 -0
  128. data/lib/epuber/third_party/bower/bower_components/jquery/src/event.js +168 -325
  129. data/lib/epuber/third_party/bower/bower_components/jquery/src/exports/amd.js +3 -3
  130. data/lib/epuber/third_party/bower/bower_components/jquery/src/exports/global.js +2 -8
  131. data/lib/epuber/third_party/bower/bower_components/jquery/src/intro.js +1 -1
  132. data/lib/epuber/third_party/bower/bower_components/jquery/src/jquery.js +5 -5
  133. data/lib/epuber/third_party/bower/bower_components/jquery/src/manipulation/_evalUrl.js +6 -4
  134. data/lib/epuber/third_party/bower/bower_components/jquery/src/manipulation/buildFragment.js +102 -0
  135. data/lib/epuber/third_party/bower/bower_components/jquery/src/manipulation/getAll.js +21 -0
  136. data/lib/epuber/third_party/bower/bower_components/jquery/src/manipulation/setGlobalEval.js +20 -0
  137. data/lib/epuber/third_party/bower/bower_components/jquery/src/manipulation/support.js +7 -6
  138. data/lib/epuber/third_party/bower/bower_components/jquery/src/manipulation/var/rcheckableType.js +3 -3
  139. data/lib/epuber/third_party/bower/bower_components/jquery/src/manipulation/var/rscriptType.js +3 -0
  140. data/lib/epuber/third_party/bower/bower_components/jquery/src/manipulation/var/rtagName.js +3 -0
  141. data/lib/epuber/third_party/bower/bower_components/jquery/src/manipulation/wrapMap.js +27 -0
  142. data/lib/epuber/third_party/bower/bower_components/jquery/src/manipulation.js +206 -305
  143. data/lib/epuber/third_party/bower/bower_components/jquery/src/offset.js +40 -29
  144. data/lib/epuber/third_party/bower/bower_components/jquery/src/outro.js +1 -0
  145. data/lib/epuber/third_party/bower/bower_components/jquery/src/queue/delay.js +6 -6
  146. data/lib/epuber/third_party/bower/bower_components/jquery/src/queue.js +23 -22
  147. data/lib/epuber/third_party/bower/bower_components/jquery/src/selector-native.js +107 -68
  148. data/lib/epuber/third_party/bower/bower_components/jquery/src/selector-sizzle.js +5 -5
  149. data/lib/epuber/third_party/bower/bower_components/jquery/src/selector.js +1 -1
  150. data/lib/epuber/third_party/bower/bower_components/jquery/src/serialize.js +28 -14
  151. data/lib/epuber/third_party/bower/bower_components/jquery/src/traversing/findFilter.js +13 -13
  152. data/lib/epuber/third_party/bower/bower_components/jquery/src/traversing/var/dir.js +20 -0
  153. data/lib/epuber/third_party/bower/bower_components/jquery/src/traversing/var/rneedsContext.js +2 -2
  154. data/lib/epuber/third_party/bower/bower_components/jquery/src/traversing/var/siblings.js +15 -0
  155. data/lib/epuber/third_party/bower/bower_components/jquery/src/traversing.js +32 -56
  156. data/lib/epuber/third_party/bower/bower_components/jquery/src/var/arr.js +2 -2
  157. data/lib/epuber/third_party/bower/bower_components/jquery/src/var/class2type.js +3 -2
  158. data/lib/epuber/third_party/bower/bower_components/jquery/src/var/concat.js +2 -2
  159. data/lib/epuber/third_party/bower/bower_components/jquery/src/var/document.js +3 -0
  160. data/lib/epuber/third_party/bower/bower_components/jquery/src/var/documentElement.js +5 -0
  161. data/lib/epuber/third_party/bower/bower_components/jquery/src/var/hasOwn.js +2 -2
  162. data/lib/epuber/third_party/bower/bower_components/jquery/src/var/indexOf.js +2 -2
  163. data/lib/epuber/third_party/bower/bower_components/jquery/src/var/pnum.js +3 -3
  164. data/lib/epuber/third_party/bower/bower_components/jquery/src/var/push.js +2 -2
  165. data/lib/epuber/third_party/bower/bower_components/jquery/src/var/rcssNum.js +7 -0
  166. data/lib/epuber/third_party/bower/bower_components/jquery/src/var/rnotwhite.js +3 -3
  167. data/lib/epuber/third_party/bower/bower_components/jquery/src/var/slice.js +2 -2
  168. data/lib/epuber/third_party/bower/bower_components/jquery/src/var/support.js +3 -2
  169. data/lib/epuber/third_party/bower/bower_components/jquery/src/var/toString.js +2 -2
  170. data/lib/epuber/third_party/bower/bower_components/jquery/src/wrap.js +19 -19
  171. data/lib/epuber/third_party/bower/bower_components/spin.js/{LICENSE.txt → LICENSE.md} +2 -1
  172. data/lib/epuber/third_party/bower/bower_components/spin.js/README.md +21 -21
  173. data/lib/epuber/third_party/bower/bower_components/spin.js/bower.json +0 -1
  174. data/lib/epuber/third_party/bower/bower_components/spin.js/jquery.spin.js +23 -24
  175. data/lib/epuber/third_party/bower/bower_components/spin.js/spin.js +153 -113
  176. data/lib/epuber/third_party/bower/bower_components/spin.js/spin.min.js +2 -0
  177. data/lib/epuber/third_party/bower/bower_components/uri.js/CHANGELOG.md +424 -0
  178. data/lib/epuber/third_party/bower/bower_components/uri.js/README.md +23 -308
  179. data/lib/epuber/third_party/bower/bower_components/uri.js/SECURITY.md +12 -0
  180. data/lib/epuber/third_party/bower/bower_components/uri.js/bower.json +2 -2
  181. data/lib/epuber/third_party/bower/bower_components/uri.js/contributing.md +0 -4
  182. data/lib/epuber/third_party/bower/bower_components/uri.js/src/IPv6.js +3 -6
  183. data/lib/epuber/third_party/bower/bower_components/uri.js/src/SecondLevelDomains.js +8 -4
  184. data/lib/epuber/third_party/bower/bower_components/uri.js/src/URI.fragmentQuery.js +21 -4
  185. data/lib/epuber/third_party/bower/bower_components/uri.js/src/URI.fragmentURI.js +1 -1
  186. data/lib/epuber/third_party/bower/bower_components/uri.js/src/URI.js +312 -69
  187. data/lib/epuber/third_party/bower/bower_components/uri.js/src/URI.min.js +85 -77
  188. data/lib/epuber/third_party/bower/bower_components/uri.js/src/URITemplate.js +28 -11
  189. data/lib/epuber/third_party/bower/bower_components/uri.js/src/jquery.URI.js +17 -18
  190. data/lib/epuber/third_party/bower/bower_components/uri.js/src/jquery.URI.min.js +6 -6
  191. data/lib/epuber/third_party/bower/bower_components/uri.js/src/punycode.js +63 -38
  192. data/lib/epuber/third_party/bower.rb +2 -0
  193. data/lib/epuber/transformer/text_transformer.rb +1 -2
  194. data/lib/epuber/transformer.rb +1 -2
  195. data/lib/epuber/user_interface.rb +1 -1
  196. data/lib/epuber/vendor/hash_binding.rb +1 -1
  197. data/lib/epuber/vendor/nokogiri_extensions.rb +24 -21
  198. data/lib/epuber/vendor/ruby_templater.rb +1 -2
  199. data/lib/epuber/vendor/size.rb +1 -0
  200. data/lib/epuber/vendor/version.rb +1 -1
  201. data/lib/epuber/version.rb +2 -1
  202. data/lib/epuber.rb +1 -1
  203. metadata +48 -30
  204. data/lib/epuber/third_party/bower/bower_components/jquery/src/sizzle/dist/sizzle.min.js +0 -3
  205. data/lib/epuber/third_party/bower/bower_components/jquery/src/sizzle/dist/sizzle.min.map +0 -1
  206. data/lib/epuber/third_party/bower/bower_components/jquery/src/var/strundefined.js +0 -3
  207. data/lib/epuber/vendor/globals_context.rb +0 -26
@@ -1,23 +1,27 @@
1
- define([
1
+ define( [
2
2
  "./core",
3
+ "./var/document",
3
4
  "./var/rnotwhite",
5
+ "./ajax/var/location",
4
6
  "./ajax/var/nonce",
5
7
  "./ajax/var/rquery",
8
+
6
9
  "./core/init",
7
10
  "./ajax/parseJSON",
8
11
  "./ajax/parseXML",
12
+ "./event/trigger",
9
13
  "./deferred"
10
- ], function( jQuery, rnotwhite, nonce, rquery ) {
14
+ ], function( jQuery, document, rnotwhite, location, nonce, rquery ) {
11
15
 
12
16
  var
13
17
  rhash = /#.*$/,
14
18
  rts = /([?&])_=[^&]*/,
15
19
  rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
20
+
16
21
  // #7653, #8125, #8152: local protocol detection
17
22
  rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
18
23
  rnoContent = /^(?:GET|HEAD)$/,
19
24
  rprotocol = /^\/\//,
20
- rurl = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,
21
25
 
22
26
  /* Prefilters
23
27
  * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
@@ -40,11 +44,9 @@ var
40
44
  // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
41
45
  allTypes = "*/".concat( "*" ),
42
46
 
43
- // Document location
44
- ajaxLocation = window.location.href,
45
-
46
- // Segment location into parts
47
- ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
47
+ // Anchor tag for parsing the document origin
48
+ originAnchor = document.createElement( "a" );
49
+ originAnchor.href = location.href;
48
50
 
49
51
  // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
50
52
  function addToPrefiltersOrTransports( structure ) {
@@ -62,16 +64,18 @@ function addToPrefiltersOrTransports( structure ) {
62
64
  dataTypes = dataTypeExpression.toLowerCase().match( rnotwhite ) || [];
63
65
 
64
66
  if ( jQuery.isFunction( func ) ) {
67
+
65
68
  // For each dataType in the dataTypeExpression
66
- while ( (dataType = dataTypes[i++]) ) {
69
+ while ( ( dataType = dataTypes[ i++ ] ) ) {
70
+
67
71
  // Prepend if requested
68
- if ( dataType[0] === "+" ) {
72
+ if ( dataType[ 0 ] === "+" ) {
69
73
  dataType = dataType.slice( 1 ) || "*";
70
- (structure[ dataType ] = structure[ dataType ] || []).unshift( func );
74
+ ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
71
75
 
72
76
  // Otherwise append
73
77
  } else {
74
- (structure[ dataType ] = structure[ dataType ] || []).push( func );
78
+ ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
75
79
  }
76
80
  }
77
81
  }
@@ -89,14 +93,16 @@ function inspectPrefiltersOrTransports( structure, options, originalOptions, jqX
89
93
  inspected[ dataType ] = true;
90
94
  jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
91
95
  var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
92
- if ( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
96
+ if ( typeof dataTypeOrTransport === "string" &&
97
+ !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
98
+
93
99
  options.dataTypes.unshift( dataTypeOrTransport );
94
100
  inspect( dataTypeOrTransport );
95
101
  return false;
96
102
  } else if ( seekingTransport ) {
97
103
  return !( selected = dataTypeOrTransport );
98
104
  }
99
- });
105
+ } );
100
106
  return selected;
101
107
  }
102
108
 
@@ -112,7 +118,7 @@ function ajaxExtend( target, src ) {
112
118
 
113
119
  for ( key in src ) {
114
120
  if ( src[ key ] !== undefined ) {
115
- ( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];
121
+ ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
116
122
  }
117
123
  }
118
124
  if ( deep ) {
@@ -136,7 +142,7 @@ function ajaxHandleResponses( s, jqXHR, responses ) {
136
142
  while ( dataTypes[ 0 ] === "*" ) {
137
143
  dataTypes.shift();
138
144
  if ( ct === undefined ) {
139
- ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
145
+ ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
140
146
  }
141
147
  }
142
148
 
@@ -154,9 +160,10 @@ function ajaxHandleResponses( s, jqXHR, responses ) {
154
160
  if ( dataTypes[ 0 ] in responses ) {
155
161
  finalDataType = dataTypes[ 0 ];
156
162
  } else {
163
+
157
164
  // Try convertible dataTypes
158
165
  for ( type in responses ) {
159
- if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
166
+ if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
160
167
  finalDataType = type;
161
168
  break;
162
169
  }
@@ -164,6 +171,7 @@ function ajaxHandleResponses( s, jqXHR, responses ) {
164
171
  firstDataType = type;
165
172
  }
166
173
  }
174
+
167
175
  // Or just use first one
168
176
  finalDataType = finalDataType || firstDataType;
169
177
  }
@@ -185,6 +193,7 @@ function ajaxHandleResponses( s, jqXHR, responses ) {
185
193
  function ajaxConvert( s, response, jqXHR, isSuccess ) {
186
194
  var conv2, current, conv, tmp, prev,
187
195
  converters = {},
196
+
188
197
  // Work with a copy of dataTypes in case we need to modify it for conversion
189
198
  dataTypes = s.dataTypes.slice();
190
199
 
@@ -237,6 +246,7 @@ function ajaxConvert( s, response, jqXHR, isSuccess ) {
237
246
  conv = converters[ prev + " " + tmp[ 0 ] ] ||
238
247
  converters[ "* " + tmp[ 0 ] ];
239
248
  if ( conv ) {
249
+
240
250
  // Condense equivalence converters
241
251
  if ( conv === true ) {
242
252
  conv = converters[ conv2 ];
@@ -256,13 +266,16 @@ function ajaxConvert( s, response, jqXHR, isSuccess ) {
256
266
  if ( conv !== true ) {
257
267
 
258
268
  // Unless errors are allowed to bubble, catch and return them
259
- if ( conv && s[ "throws" ] ) {
269
+ if ( conv && s.throws ) {
260
270
  response = conv( response );
261
271
  } else {
262
272
  try {
263
273
  response = conv( response );
264
274
  } catch ( e ) {
265
- return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current };
275
+ return {
276
+ state: "parsererror",
277
+ error: conv ? e : "No conversion from " + prev + " to " + current
278
+ };
266
279
  }
267
280
  }
268
281
  }
@@ -273,7 +286,7 @@ function ajaxConvert( s, response, jqXHR, isSuccess ) {
273
286
  return { state: "success", data: response };
274
287
  }
275
288
 
276
- jQuery.extend({
289
+ jQuery.extend( {
277
290
 
278
291
  // Counter for holding the number of active queries
279
292
  active: 0,
@@ -283,9 +296,9 @@ jQuery.extend({
283
296
  etag: {},
284
297
 
285
298
  ajaxSettings: {
286
- url: ajaxLocation,
299
+ url: location.href,
287
300
  type: "GET",
288
- isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
301
+ isLocal: rlocalProtocol.test( location.protocol ),
289
302
  global: true,
290
303
  processData: true,
291
304
  async: true,
@@ -311,9 +324,9 @@ jQuery.extend({
311
324
  },
312
325
 
313
326
  contents: {
314
- xml: /xml/,
315
- html: /html/,
316
- json: /json/
327
+ xml: /\bxml\b/,
328
+ html: /\bhtml/,
329
+ json: /\bjson\b/
317
330
  },
318
331
 
319
332
  responseFields: {
@@ -378,39 +391,55 @@ jQuery.extend({
378
391
  options = options || {};
379
392
 
380
393
  var transport,
394
+
381
395
  // URL without anti-cache param
382
396
  cacheURL,
397
+
383
398
  // Response headers
384
399
  responseHeadersString,
385
400
  responseHeaders,
401
+
386
402
  // timeout handle
387
403
  timeoutTimer,
388
- // Cross-domain detection vars
389
- parts,
404
+
405
+ // Url cleanup var
406
+ urlAnchor,
407
+
390
408
  // To know if global events are to be dispatched
391
409
  fireGlobals,
410
+
392
411
  // Loop variable
393
412
  i,
413
+
394
414
  // Create the final options object
395
415
  s = jQuery.ajaxSetup( {}, options ),
416
+
396
417
  // Callbacks context
397
418
  callbackContext = s.context || s,
419
+
398
420
  // Context for global events is callbackContext if it is a DOM node or jQuery collection
399
- globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ?
400
- jQuery( callbackContext ) :
401
- jQuery.event,
421
+ globalEventContext = s.context &&
422
+ ( callbackContext.nodeType || callbackContext.jquery ) ?
423
+ jQuery( callbackContext ) :
424
+ jQuery.event,
425
+
402
426
  // Deferreds
403
427
  deferred = jQuery.Deferred(),
404
- completeDeferred = jQuery.Callbacks("once memory"),
428
+ completeDeferred = jQuery.Callbacks( "once memory" ),
429
+
405
430
  // Status-dependent callbacks
406
431
  statusCode = s.statusCode || {},
432
+
407
433
  // Headers (they are sent all at once)
408
434
  requestHeaders = {},
409
435
  requestHeadersNames = {},
436
+
410
437
  // The jqXHR state
411
438
  state = 0,
439
+
412
440
  // Default abort message
413
441
  strAbort = "canceled",
442
+
414
443
  // Fake xhr
415
444
  jqXHR = {
416
445
  readyState: 0,
@@ -421,8 +450,8 @@ jQuery.extend({
421
450
  if ( state === 2 ) {
422
451
  if ( !responseHeaders ) {
423
452
  responseHeaders = {};
424
- while ( (match = rheaders.exec( responseHeadersString )) ) {
425
- responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
453
+ while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
454
+ responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ];
426
455
  }
427
456
  }
428
457
  match = responseHeaders[ key.toLowerCase() ];
@@ -459,10 +488,12 @@ jQuery.extend({
459
488
  if ( map ) {
460
489
  if ( state < 2 ) {
461
490
  for ( code in map ) {
491
+
462
492
  // Lazy-add the new callback in a way that preserves old ones
463
493
  statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
464
494
  }
465
495
  } else {
496
+
466
497
  // Execute the appropriate callbacks
467
498
  jqXHR.always( map[ jqXHR.status ] );
468
499
  }
@@ -490,8 +521,8 @@ jQuery.extend({
490
521
  // Add protocol if not provided (prefilters might expect it)
491
522
  // Handle falsy url in the settings object (#10093: consistency with old signature)
492
523
  // We also use the url parameter if available
493
- s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" )
494
- .replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
524
+ s.url = ( ( url || s.url || location.href ) + "" ).replace( rhash, "" )
525
+ .replace( rprotocol, location.protocol + "//" );
495
526
 
496
527
  // Alias method option to type as per ticket #12004
497
528
  s.type = options.method || options.type || s.method || s.type;
@@ -499,14 +530,26 @@ jQuery.extend({
499
530
  // Extract dataTypes list
500
531
  s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( rnotwhite ) || [ "" ];
501
532
 
502
- // A cross-domain request is in order when we have a protocol:host:port mismatch
533
+ // A cross-domain request is in order when the origin doesn't match the current origin.
503
534
  if ( s.crossDomain == null ) {
504
- parts = rurl.exec( s.url.toLowerCase() );
505
- s.crossDomain = !!( parts &&
506
- ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
507
- ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !==
508
- ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? "80" : "443" ) ) )
509
- );
535
+ urlAnchor = document.createElement( "a" );
536
+
537
+ // Support: IE8-11+
538
+ // IE throws exception if url is malformed, e.g. http://example.com:80x/
539
+ try {
540
+ urlAnchor.href = s.url;
541
+
542
+ // Support: IE8-11+
543
+ // Anchor's host property isn't correctly set when s.url is relative
544
+ urlAnchor.href = urlAnchor.href;
545
+ s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
546
+ urlAnchor.protocol + "//" + urlAnchor.host;
547
+ } catch ( e ) {
548
+
549
+ // If there is an error parsing the URL, assume it is crossDomain,
550
+ // it can be rejected by the transport if it is invalid
551
+ s.crossDomain = true;
552
+ }
510
553
  }
511
554
 
512
555
  // Convert data if not already a string
@@ -528,7 +571,7 @@ jQuery.extend({
528
571
 
529
572
  // Watch for a new set of requests
530
573
  if ( fireGlobals && jQuery.active++ === 0 ) {
531
- jQuery.event.trigger("ajaxStart");
574
+ jQuery.event.trigger( "ajaxStart" );
532
575
  }
533
576
 
534
577
  // Uppercase the type
@@ -547,6 +590,7 @@ jQuery.extend({
547
590
  // If data is available, append data to url
548
591
  if ( s.data ) {
549
592
  cacheURL = ( s.url += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data );
593
+
550
594
  // #9682: remove data so that it's not used in an eventual retry
551
595
  delete s.data;
552
596
  }
@@ -581,8 +625,9 @@ jQuery.extend({
581
625
  // Set the Accepts header for the server, depending on the dataType
582
626
  jqXHR.setRequestHeader(
583
627
  "Accept",
584
- s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
585
- s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
628
+ s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
629
+ s.accepts[ s.dataTypes[ 0 ] ] +
630
+ ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
586
631
  s.accepts[ "*" ]
587
632
  );
588
633
 
@@ -592,7 +637,9 @@ jQuery.extend({
592
637
  }
593
638
 
594
639
  // Allow custom headers/mimetypes and early abort
595
- if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
640
+ if ( s.beforeSend &&
641
+ ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
642
+
596
643
  // Abort if not done already and return
597
644
  return jqXHR.abort();
598
645
  }
@@ -618,10 +665,16 @@ jQuery.extend({
618
665
  if ( fireGlobals ) {
619
666
  globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
620
667
  }
668
+
669
+ // If request was aborted inside ajaxSend, stop there
670
+ if ( state === 2 ) {
671
+ return jqXHR;
672
+ }
673
+
621
674
  // Timeout
622
675
  if ( s.async && s.timeout > 0 ) {
623
- timeoutTimer = setTimeout(function() {
624
- jqXHR.abort("timeout");
676
+ timeoutTimer = window.setTimeout( function() {
677
+ jqXHR.abort( "timeout" );
625
678
  }, s.timeout );
626
679
  }
627
680
 
@@ -629,9 +682,11 @@ jQuery.extend({
629
682
  state = 1;
630
683
  transport.send( requestHeaders, done );
631
684
  } catch ( e ) {
685
+
632
686
  // Propagate exception as error if not done
633
687
  if ( state < 2 ) {
634
688
  done( -1, e );
689
+
635
690
  // Simply rethrow otherwise
636
691
  } else {
637
692
  throw e;
@@ -654,7 +709,7 @@ jQuery.extend({
654
709
 
655
710
  // Clear timeout if it exists
656
711
  if ( timeoutTimer ) {
657
- clearTimeout( timeoutTimer );
712
+ window.clearTimeout( timeoutTimer );
658
713
  }
659
714
 
660
715
  // Dereference transport for early garbage collection
@@ -683,11 +738,11 @@ jQuery.extend({
683
738
 
684
739
  // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
685
740
  if ( s.ifModified ) {
686
- modified = jqXHR.getResponseHeader("Last-Modified");
741
+ modified = jqXHR.getResponseHeader( "Last-Modified" );
687
742
  if ( modified ) {
688
743
  jQuery.lastModified[ cacheURL ] = modified;
689
744
  }
690
- modified = jqXHR.getResponseHeader("etag");
745
+ modified = jqXHR.getResponseHeader( "etag" );
691
746
  if ( modified ) {
692
747
  jQuery.etag[ cacheURL ] = modified;
693
748
  }
@@ -709,6 +764,7 @@ jQuery.extend({
709
764
  isSuccess = !error;
710
765
  }
711
766
  } else {
767
+
712
768
  // Extract error from statusText and normalize for non-aborts
713
769
  error = statusText;
714
770
  if ( status || !statusText ) {
@@ -744,9 +800,10 @@ jQuery.extend({
744
800
 
745
801
  if ( fireGlobals ) {
746
802
  globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
803
+
747
804
  // Handle the global AJAX counter
748
805
  if ( !( --jQuery.active ) ) {
749
- jQuery.event.trigger("ajaxStop");
806
+ jQuery.event.trigger( "ajaxStop" );
750
807
  }
751
808
  }
752
809
  }
@@ -761,10 +818,11 @@ jQuery.extend({
761
818
  getScript: function( url, callback ) {
762
819
  return jQuery.get( url, undefined, callback, "script" );
763
820
  }
764
- });
821
+ } );
765
822
 
766
823
  jQuery.each( [ "get", "post" ], function( i, method ) {
767
824
  jQuery[ method ] = function( url, data, callback, type ) {
825
+
768
826
  // Shift arguments if data argument was omitted
769
827
  if ( jQuery.isFunction( data ) ) {
770
828
  type = type || callback;
@@ -772,15 +830,16 @@ jQuery.each( [ "get", "post" ], function( i, method ) {
772
830
  data = undefined;
773
831
  }
774
832
 
775
- return jQuery.ajax({
833
+ // The url can be an options object (which then must have .url)
834
+ return jQuery.ajax( jQuery.extend( {
776
835
  url: url,
777
836
  type: method,
778
837
  dataType: type,
779
838
  data: data,
780
839
  success: callback
781
- });
840
+ }, jQuery.isPlainObject( url ) && url ) );
782
841
  };
783
- });
842
+ } );
784
843
 
785
844
  return jQuery;
786
- });
845
+ } );
@@ -1,39 +1,38 @@
1
- define([
1
+ define( [
2
2
  "../core",
3
- "../var/rnotwhite",
4
- "../var/strundefined",
5
3
  "../core/access",
6
4
  "./support",
5
+ "../var/rnotwhite",
7
6
  "../selector"
8
- ], function( jQuery, rnotwhite, strundefined, access, support ) {
7
+ ], function( jQuery, access, support, rnotwhite ) {
9
8
 
10
- var nodeHook, boolHook,
9
+ var boolHook,
11
10
  attrHandle = jQuery.expr.attrHandle;
12
11
 
13
- jQuery.fn.extend({
12
+ jQuery.fn.extend( {
14
13
  attr: function( name, value ) {
15
14
  return access( this, jQuery.attr, name, value, arguments.length > 1 );
16
15
  },
17
16
 
18
17
  removeAttr: function( name ) {
19
- return this.each(function() {
18
+ return this.each( function() {
20
19
  jQuery.removeAttr( this, name );
21
- });
20
+ } );
22
21
  }
23
- });
22
+ } );
24
23
 
25
- jQuery.extend({
24
+ jQuery.extend( {
26
25
  attr: function( elem, name, value ) {
27
- var hooks, ret,
26
+ var ret, hooks,
28
27
  nType = elem.nodeType;
29
28
 
30
- // don't get/set attributes on text, comment and attribute nodes
31
- if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
29
+ // Don't get/set attributes on text, comment and attribute nodes
30
+ if ( nType === 3 || nType === 8 || nType === 2 ) {
32
31
  return;
33
32
  }
34
33
 
35
34
  // Fallback to prop when attributes are not supported
36
- if ( typeof elem.getAttribute === strundefined ) {
35
+ if ( typeof elem.getAttribute === "undefined" ) {
37
36
  return jQuery.prop( elem, name, value );
38
37
  }
39
38
 
@@ -42,32 +41,47 @@ jQuery.extend({
42
41
  if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
43
42
  name = name.toLowerCase();
44
43
  hooks = jQuery.attrHooks[ name ] ||
45
- ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook );
44
+ ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
46
45
  }
47
46
 
48
47
  if ( value !== undefined ) {
49
-
50
48
  if ( value === null ) {
51
49
  jQuery.removeAttr( elem, name );
50
+ return;
51
+ }
52
52
 
53
- } else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
53
+ if ( hooks && "set" in hooks &&
54
+ ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
54
55
  return ret;
55
-
56
- } else {
57
- elem.setAttribute( name, value + "" );
58
- return value;
59
56
  }
60
57
 
61
- } else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
58
+ elem.setAttribute( name, value + "" );
59
+ return value;
60
+ }
61
+
62
+ if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
62
63
  return ret;
64
+ }
63
65
 
64
- } else {
65
- ret = jQuery.find.attr( elem, name );
66
+ ret = jQuery.find.attr( elem, name );
67
+
68
+ // Non-existent attributes return null, we normalize to undefined
69
+ return ret == null ? undefined : ret;
70
+ },
66
71
 
67
- // Non-existent attributes return null, we normalize to undefined
68
- return ret == null ?
69
- undefined :
70
- ret;
72
+ attrHooks: {
73
+ type: {
74
+ set: function( elem, value ) {
75
+ if ( !support.radioValue && value === "radio" &&
76
+ jQuery.nodeName( elem, "input" ) ) {
77
+ var val = elem.value;
78
+ elem.setAttribute( "type", value );
79
+ if ( val ) {
80
+ elem.value = val;
81
+ }
82
+ return value;
83
+ }
84
+ }
71
85
  }
72
86
  },
73
87
 
@@ -77,11 +91,12 @@ jQuery.extend({
77
91
  attrNames = value && value.match( rnotwhite );
78
92
 
79
93
  if ( attrNames && elem.nodeType === 1 ) {
80
- while ( (name = attrNames[i++]) ) {
94
+ while ( ( name = attrNames[ i++ ] ) ) {
81
95
  propName = jQuery.propFix[ name ] || name;
82
96
 
83
97
  // Boolean attributes get special treatment (#10870)
84
98
  if ( jQuery.expr.match.bool.test( name ) ) {
99
+
85
100
  // Set corresponding property to false
86
101
  elem[ propName ] = false;
87
102
  }
@@ -89,29 +104,14 @@ jQuery.extend({
89
104
  elem.removeAttribute( name );
90
105
  }
91
106
  }
92
- },
93
-
94
- attrHooks: {
95
- type: {
96
- set: function( elem, value ) {
97
- if ( !support.radioValue && value === "radio" &&
98
- jQuery.nodeName( elem, "input" ) ) {
99
- var val = elem.value;
100
- elem.setAttribute( "type", value );
101
- if ( val ) {
102
- elem.value = val;
103
- }
104
- return value;
105
- }
106
- }
107
- }
108
107
  }
109
- });
108
+ } );
110
109
 
111
110
  // Hooks for boolean attributes
112
111
  boolHook = {
113
112
  set: function( elem, value, name ) {
114
113
  if ( value === false ) {
114
+
115
115
  // Remove boolean attributes when set to false
116
116
  jQuery.removeAttr( elem, name );
117
117
  } else {
@@ -126,6 +126,7 @@ jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name )
126
126
  attrHandle[ name ] = function( elem, name, isXML ) {
127
127
  var ret, handle;
128
128
  if ( !isXML ) {
129
+
129
130
  // Avoid an infinite loop by temporarily removing this function from the getter
130
131
  handle = attrHandle[ name ];
131
132
  attrHandle[ name ] = ret;
@@ -136,6 +137,6 @@ jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name )
136
137
  }
137
138
  return ret;
138
139
  };
139
- });
140
+ } );
140
141
 
141
- });
142
+ } );