jquery-rails 4.1.1 → 4.3.4

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.

Potentially problematic release.


This version of jquery-rails might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 1de8e28727522dbf3117a3eb28fdb73400081822
4
- data.tar.gz: 15b7094fc48bec31875aa548874961c491b25791
2
+ SHA256:
3
+ metadata.gz: 8b52a193e419a4e8a0da353faf40d8d66705bdf64171fb6c800b637119541ac9
4
+ data.tar.gz: f44fd79c6c3ce8d0b40892f71bd9ec5f570ed56c01c9396281d4909f8ce48d60
5
5
  SHA512:
6
- metadata.gz: 063d686e51ca1ca75d124c3791bf837a949f85dbc4f64a7bde7e600814dc0851586c542c02bbf8a75db6e313094a20a68e1528438e8e5d8773e0dc3cecbada93
7
- data.tar.gz: 8b9bfa12d4f816d5ea2a59e5e720c79d33a0fc64a292692273aed5c84132c1a7cd234ddf384090a688d326f3142fae58582102e3fa8c9d11afd0fd35fa11da25
6
+ metadata.gz: b7c4027d93c8fba8669eadf6b469d83f85252e225b2d1d9ccbd6f254785b8c44fdc31bf67ad278305e776df0868149324bd2745df26396d48e74260992630493
7
+ data.tar.gz: ea65dae08a0209aa928eb0196768d7a8811b5be9757dda5289c9505420f6b7cfb8795f1e0da2090198c2bd0be54c3b019561ed775d0f9b6848cb43d8c8f6e835
data/.travis.yml CHANGED
@@ -4,15 +4,18 @@ language: ruby
4
4
  rvm:
5
5
  - 1.9.3
6
6
  - 2.0.0
7
- - 2.1
8
- - 2.2
9
- - 2.3.0
7
+ - 2.1.10
8
+ - 2.2.9
9
+ - 2.3.6
10
+ - 2.4.3
11
+ - 2.5.0
10
12
  - jruby
11
13
  - ruby-head
12
14
  matrix:
13
15
  fast_finish: true
14
16
  allow_failures:
15
17
  - rvm: jruby
18
+ - rvm: ruby-head
16
19
  notifications:
17
20
  email: false
18
21
  irc:
data/CHANGELOG.md CHANGED
@@ -1,3 +1,41 @@
1
+ ## 4.3.4
2
+
3
+ - update jquery to 3.4.0
4
+
5
+ ## 4.3.3
6
+
7
+ - update jquery to 3.3.1
8
+
9
+ ## 4.3.2
10
+
11
+ - update jquery to 3.3.0
12
+ - Add possibility to test HTML: all, attribute prefix, attribute contains,
13
+ attribute ends with, child, and class selectors
14
+ - Fix matching mutiple calls for the same selector/function exception
15
+
16
+ ## 4.3.1
17
+
18
+ - update jquery to 3.2.1
19
+
20
+ ## 4.3.0
21
+
22
+ - update jquery to 3.2.0
23
+ - Add possibility to test HTML attribute selectors
24
+
25
+ ## 4.2.2
26
+
27
+ - update jquery to 3.1.1
28
+
29
+ ## 4.2.1
30
+
31
+ - update jquery to 3.1.0
32
+
33
+ ## 4.2.0
34
+
35
+ - Support jQuery 3.x
36
+ - Update jquery-ujs to 1.2.2
37
+ - Update jQuery to 1.12.4 and 2.2.4
38
+
1
39
  ## 4.1.1
2
40
 
3
41
  - Update jQuery to 1.12.1 and 2.2.1
data/Gemfile CHANGED
@@ -1,6 +1,22 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'rails', group: :test
3
+ gem "mime-types", "< 3", group: :test
4
+
5
+ if RUBY_VERSION >= '2.2.2'
6
+ gem 'rails'
7
+ gem 'rack'
8
+ gem 'json', '>= 2'
9
+ else
10
+ gem 'rails', '~> 4.2.0'
11
+ gem 'rack', '~>1.6'
12
+ gem 'json', '~> 1.8.0'
13
+ end
14
+
15
+ if RUBY_VERSION >= '2.1'
16
+ gem 'nokogiri'
17
+ else
18
+ gem 'nokogiri', '~> 1.6.0'
19
+ end
4
20
 
5
21
  # Specify your gem's dependencies in jquery-rails.gemspec
6
22
  gemspec
data/README.md CHANGED
@@ -4,7 +4,7 @@ jQuery! For Rails! So great.
4
4
 
5
5
  This gem provides:
6
6
 
7
- * jQuery 1 and jQuery 2
7
+ * jQuery 1, 2 and 3
8
8
  * the jQuery UJS adapter
9
9
  * assert_select_jquery to test jQuery responses in Ruby tests
10
10
 
@@ -24,6 +24,12 @@ versions of jQuery.
24
24
 
25
25
  ## Installation
26
26
 
27
+ Add
28
+ ```
29
+ gem 'jquery-rails'
30
+ ```
31
+ to your Gemfile.
32
+
27
33
  The jquery and jquery-ujs files will be added to the asset pipeline and available for you to use. If they're not already in `app/assets/javascripts/application.js` by default, add these lines:
28
34
 
29
35
  ```js
@@ -31,6 +37,12 @@ The jquery and jquery-ujs files will be added to the asset pipeline and availabl
31
37
  //= require jquery_ujs
32
38
  ```
33
39
 
40
+ If you are running Rails 5.1 and up, and if you have included `//= require rails-ujs`, then `jquery_ujs` is not needed anymore. You can just add:
41
+
42
+ ```js
43
+ //= require jquery
44
+ ```
45
+
34
46
  If you want to use jQuery 2, you can require `jquery2` instead:
35
47
 
36
48
  ```js
@@ -38,6 +50,13 @@ If you want to use jQuery 2, you can require `jquery2` instead:
38
50
  //= require jquery_ujs
39
51
  ```
40
52
 
53
+ And if you want to use jQuery 3, you can require `jquery3`:
54
+
55
+ ```js
56
+ //= require jquery3
57
+ //= require jquery_ujs
58
+ ```
59
+
41
60
  For jQuery UI, we recommend the [jquery-ui-rails](https://github.com/joliss/jquery-ui-rails) gem, as it includes the jquery-ui css and allows easier customization.
42
61
 
43
62
  *As of v3.0, jquery-rails no longer includes jQuery UI. Use the
@@ -59,4 +78,4 @@ jquery-rails is released under the [MIT License](MIT-LICENSE).
59
78
 
60
79
  ## Acknowledgements
61
80
 
62
- Many thanks are due to all of [the jquery-rails contributors](https://github.com/rails/jquery-rails/graphs/contributors). Special thanks to [JangoSteve](http://github.com/JangoSteve) for tirelessly answering questions and accepting patches, and the [Rails Core Team](https://github.com/organizations/rails/teams/617) for making jquery-rails an official part of Rails 3.1.
81
+ Many thanks are due to all of [the jquery-rails contributors](https://github.com/rails/jquery-rails/graphs/contributors). Special thanks to [JangoSteve](http://github.com/JangoSteve) for tirelessly answering questions and accepting patches, and the [Rails Core Team](https://github.com/orgs/rails/people) for making jquery-rails an official part of Rails 3.1.
data/Rakefile CHANGED
@@ -29,6 +29,7 @@ task :guard_version do
29
29
 
30
30
  check_version('jquery.js', /jQuery JavaScript Library v([\S]+)/, 'JQUERY_VERSION')
31
31
  check_version('jquery2.js', /jQuery JavaScript Library v([\S]+)/, 'JQUERY_2_VERSION')
32
+ check_version('jquery3.js', /jQuery JavaScript Library v([\S]+)/, 'JQUERY_3_VERSION')
32
33
  end
33
34
 
34
35
  desc "Update jQuery versions"
@@ -37,15 +38,16 @@ task :update_jquery do
37
38
  suffix = "-#{version}"
38
39
 
39
40
  puts "Downloading #{filename}.js"
40
- puts `curl -o vendor/assets/javascripts/#{filename}.js http://code.jquery.com/jquery#{suffix}.js`
41
+ puts `curl -o vendor/assets/javascripts/#{filename}.js https://code.jquery.com/jquery#{suffix}.js`
41
42
  puts "Downloading #{filename}.min.js"
42
- puts `curl -o vendor/assets/javascripts/#{filename}.min.js http://code.jquery.com/jquery#{suffix}.min.js`
43
+ puts `curl -o vendor/assets/javascripts/#{filename}.min.js https://code.jquery.com/jquery#{suffix}.min.js`
43
44
  puts "Downloading #{filename}.min.map"
44
- puts `curl -o vendor/assets/javascripts/#{filename}.min.map http://code.jquery.com/jquery#{suffix}.min.map`
45
+ puts `curl -o vendor/assets/javascripts/#{filename}.min.map https://code.jquery.com/jquery#{suffix}.min.map`
45
46
  end
46
47
 
47
48
  download_jquery('jquery', Jquery::Rails::JQUERY_VERSION)
48
49
  download_jquery('jquery2', Jquery::Rails::JQUERY_2_VERSION)
50
+ download_jquery('jquery3', Jquery::Rails::JQUERY_3_VERSION)
49
51
  puts "\e[32mDone!\e[0m"
50
52
  end
51
53
 
data/VERSIONS.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  | Gem | jQuery | jQuery UJS | jQuery UI |
4
4
  |--------|--------|------------| ----------|
5
+ | 4.3.4 | 1.12.4 & 2.2.4 & 3.4.0 | 1.2.2 | - |
6
+ | 4.3.3 | 1.12.4 & 2.2.4 & 3.3.1 | 1.2.2 | - |
7
+ | 4.3.2 | 1.12.4 & 2.2.4 & 3.3.0 | 1.2.2 | - |
8
+ | 4.3.1 | 1.12.4 & 2.2.4 & 3.2.1 | 1.2.2 | - |
9
+ | 4.3.0 | 1.12.4 & 2.2.4 & 3.2.0 | 1.2.2 | - |
10
+ | 4.2.2 | 1.12.4 & 2.2.4 & 3.1.1 | 1.2.2 | - |
11
+ | 4.2.1 | 1.12.4 & 2.2.4 & 3.1.0 | 1.2.2 | - |
12
+ | 4.2.0 | 1.12.4 & 2.2.4 & 3.0.0 | 1.2.2 | - |
5
13
  | 4.1.1 | 1.12.1 & 2.2.1 | 1.2.1 | - |
6
14
  | 4.1.0 | 1.12.0 & 2.2.0 | 1.2.0 | - |
7
15
  | 4.0.5 | 1.11.3 & 2.1.4 | 1.1.0 | - |
data/jquery-rails.gemspec CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ["André Arko"]
9
9
  s.email = ["andre@arko.net"]
10
- s.homepage = "http://rubygems.org/gems/jquery-rails"
10
+ s.homepage = "https://github.com/rails/jquery-rails"
11
11
  s.summary = "Use jQuery with Rails 4+"
12
12
  s.description = "This gem provides jQuery and the jQuery-ujs driver for your Rails 4+ application."
13
13
  s.license = "MIT"
@@ -47,14 +47,14 @@ module Rails::Dom::Testing::Assertions::SelectorAssertions
47
47
  # assert_select '.product'
48
48
  # end
49
49
 
50
- PATTERN_HTML = "['\"]((\\\\\"|[^\"])*)['\"]"
50
+ PATTERN_HTML = "['\"]((\\\\\"|\\\\'|[^\"'])*)['\"]"
51
51
  PATTERN_UNICODE_ESCAPED_CHAR = /\\u([0-9a-zA-Z]{4})/
52
- SKELETAL_PATTERN = "(?:jQuery|\\$)\\(%s\\)\\.%s\\(%s\\);"
52
+ SKELETAL_PATTERN = "(?:jQuery|\\$)\\(%s\\)\\.%s\\(%s\\)[;]?"
53
53
 
54
54
  def assert_select_jquery(*args, &block)
55
55
  jquery_method = args.first.is_a?(Symbol) ? args.shift : nil
56
56
  jquery_opt = args.first.is_a?(Symbol) ? args.shift : nil
57
- id = args.first.is_a?(String) ? args.shift : nil
57
+ id = args.first.is_a?(String) ? escape_id(args.shift) : nil
58
58
 
59
59
  target_pattern = "['\"]#{id || '.*'}['\"]"
60
60
  method_pattern = "#{jquery_method || '\\w+'}"
@@ -91,14 +91,14 @@ module Rails::Dom::Testing::Assertions::SelectorAssertions
91
91
 
92
92
  if block_given?
93
93
  @selected ||= nil
94
- fragments = Nokogiri::HTML::Document.new
94
+ fragments = Nokogiri::HTML::Document.new.fragment
95
95
 
96
96
  if matched_pattern
97
97
  response.body.scan(Regexp.new(matched_pattern)).each do |match|
98
98
  flunk 'This function can\'t have HTML argument' if match.is_a?(String)
99
99
 
100
- doc = Nokogiri::HTML::Document.parse(unescape_js(match.first))
101
- doc.root.children.each do |child|
100
+ doc = Nokogiri::HTML::DocumentFragment.parse(unescape_js(match.first))
101
+ doc.children.each do |child|
102
102
  fragments << child if child.element?
103
103
  end
104
104
  end
@@ -128,4 +128,22 @@ module Rails::Dom::Testing::Assertions::SelectorAssertions
128
128
  unescaped.gsub!(PATTERN_UNICODE_ESCAPED_CHAR) {|u| [$1.hex].pack('U*')}
129
129
  unescaped
130
130
  end
131
+
132
+ def escape_id(selector)
133
+ return unless selector
134
+
135
+ id = selector.gsub('[', '\[')
136
+ id.gsub!(']', '\]')
137
+ id.gsub!('*', '\*')
138
+ id.gsub!('(', '\(')
139
+ id.gsub!(')', '\)')
140
+ id.gsub!('.', '\.')
141
+ id.gsub!('|', '\|')
142
+ id.gsub!('^', '\^')
143
+ id.gsub!('$', '\$')
144
+ id.gsub!('+', "\\\\+")
145
+ id.gsub!(',', '\,')
146
+
147
+ id
148
+ end
131
149
  end
@@ -1,8 +1,9 @@
1
1
  module Jquery
2
2
  module Rails
3
- VERSION = "4.1.1"
4
- JQUERY_VERSION = "1.12.1"
5
- JQUERY_2_VERSION = "2.2.1"
6
- JQUERY_UJS_VERSION = "1.2.1"
3
+ VERSION = "4.3.4"
4
+ JQUERY_VERSION = "1.12.4"
5
+ JQUERY_2_VERSION = "2.2.4"
6
+ JQUERY_3_VERSION = "3.4.0"
7
+ JQUERY_UJS_VERSION = "1.2.2"
7
8
  end
8
9
  end
@@ -1,3 +1,4 @@
1
+ require 'ostruct'
1
2
  require_relative 'test_helper'
2
3
  require_relative '../lib/jquery/assert_select'
3
4
 
@@ -8,11 +9,20 @@ class AssertSelectJQueryTest < ActiveSupport::TestCase
8
9
  JAVASCRIPT_TEST_OUTPUT = <<-JS
9
10
  $("#card").show("blind", 1000);
10
11
  $("#id").html('<div><p>something</p></div>');
12
+ $('#card').html('<div><p>something else</p></div>');
11
13
  jQuery("#id").replaceWith("<div><p>something</p></div>");
12
14
  $("<div><p>something</p></div>").appendTo("#id");
15
+ $("<div><p>something else</p></div>").appendTo("#id");
13
16
  jQuery("<div><p>something</p></div>").prependTo("#id");
14
17
  $('#id').remove();
15
18
  jQuery("#id").hide();
19
+ $("[data-placeholder~=name]").remove();
20
+ $("#cart tr:not(.total_line) > *").remove();
21
+ $("[href|=\"val\"][href$=\"val\"][href^=\"val\"]").remove();
22
+ $("tr + td, li").remove();
23
+
24
+ // without semicolon
25
+ $("#browser_cart").hide("blind", 1000)
16
26
  JS
17
27
 
18
28
  setup do
@@ -22,23 +32,35 @@ class AssertSelectJQueryTest < ActiveSupport::TestCase
22
32
  def test_target_as_receiver
23
33
  assert_nothing_raised do
24
34
  assert_select_jquery :show, :blind, '#card'
35
+ assert_select_jquery :hide, :blind, '#browser_cart'
25
36
  assert_select_jquery :html, '#id' do
26
37
  assert_select 'p', 'something'
27
38
  end
28
39
  assert_select_jquery :replaceWith, '#id' do
29
40
  assert_select 'p', 'something'
30
41
  end
42
+ assert_select_jquery :remove, "[data-placeholder~=name]"
43
+ assert_select_jquery :remove, "#cart tr:not(.total_line) > *"
44
+ assert_select_jquery :remove, "[href|=\"val\"][href$=\"val\"][href^=\"val\"]"
45
+ assert_select_jquery :remove, "tr + td, li"
31
46
  end
32
47
 
33
48
  assert_raise Minitest::Assertion, "No JQuery call matches [:show, :some_wrong]" do
34
49
  assert_select_jquery :show, :some_wrong
35
50
  end
51
+
52
+ assert_raise Minitest::Assertion, "<something else> was expected but was <something>" do
53
+ assert_select_jquery :html, '#id' do
54
+ assert_select 'p', 'something else'
55
+ end
56
+ end
36
57
  end
37
58
 
38
59
  def test_target_as_argument
39
60
  assert_nothing_raised do
40
61
  assert_select_jquery :appendTo, '#id' do
41
62
  assert_select 'p', 'something'
63
+ assert_select 'p', 'something else'
42
64
  end
43
65
  assert_select_jquery :prependTo, '#id' do
44
66
  assert_select 'p', 'something'
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * jQuery JavaScript Library v1.12.1
2
+ * jQuery JavaScript Library v1.12.4
3
3
  * http://jquery.com/
4
4
  *
5
5
  * Includes Sizzle.js
@@ -9,7 +9,7 @@
9
9
  * Released under the MIT license
10
10
  * http://jquery.org/license
11
11
  *
12
- * Date: 2016-02-22T19:07Z
12
+ * Date: 2016-05-20T17:17Z
13
13
  */
14
14
 
15
15
  (function( global, factory ) {
@@ -65,7 +65,7 @@ var support = {};
65
65
 
66
66
 
67
67
  var
68
- version = "1.12.1",
68
+ version = "1.12.4",
69
69
 
70
70
  // Define a local copy of jQuery
71
71
  jQuery = function( selector, context ) {
@@ -6672,6 +6672,7 @@ var documentElement = document.documentElement;
6672
6672
  if ( reliableHiddenOffsetsVal ) {
6673
6673
  div.style.display = "";
6674
6674
  div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>";
6675
+ div.childNodes[ 0 ].style.borderCollapse = "separate";
6675
6676
  contents = div.getElementsByTagName( "td" );
6676
6677
  contents[ 0 ].style.cssText = "margin:0;border:0;padding:0;display:none";
6677
6678
  reliableHiddenOffsetsVal = contents[ 0 ].offsetHeight === 0;
@@ -6996,19 +6997,6 @@ function getWidthOrHeight( elem, name, extra ) {
6996
6997
  isBorderBox = support.boxSizing &&
6997
6998
  jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
6998
6999
 
6999
- // Support: IE11 only
7000
- // In IE 11 fullscreen elements inside of an iframe have
7001
- // 100x too small dimensions (gh-1764).
7002
- if ( document.msFullscreenElement && window.top !== window ) {
7003
-
7004
- // Support: IE11 only
7005
- // Running getBoundingClientRect on a disconnected node
7006
- // in IE throws an error.
7007
- if ( elem.getClientRects().length ) {
7008
- val = Math.round( elem.getBoundingClientRect()[ name ] * 100 );
7009
- }
7010
- }
7011
-
7012
7000
  // some non-html elements return undefined for offsetWidth, so check for null/undefined
7013
7001
  // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
7014
7002
  // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
@@ -8198,7 +8186,8 @@ jQuery.fn.delay = function( time, type ) {
8198
8186
  } )();
8199
8187
 
8200
8188
 
8201
- var rreturn = /\r/g;
8189
+ var rreturn = /\r/g,
8190
+ rspaces = /[\x20\t\r\n\f]+/g;
8202
8191
 
8203
8192
  jQuery.fn.extend( {
8204
8193
  val: function( value ) {
@@ -8278,7 +8267,9 @@ jQuery.extend( {
8278
8267
 
8279
8268
  // Support: IE10-11+
8280
8269
  // option.text throws exceptions (#14686, #14858)
8281
- jQuery.trim( jQuery.text( elem ) );
8270
+ // Strip and collapse whitespace
8271
+ // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
8272
+ jQuery.trim( jQuery.text( elem ) ).replace( rspaces, " " );
8282
8273
  }
8283
8274
  },
8284
8275
  select: {
@@ -8332,7 +8323,7 @@ jQuery.extend( {
8332
8323
  while ( i-- ) {
8333
8324
  option = options[ i ];
8334
8325
 
8335
- if ( jQuery.inArray( jQuery.valHooks.option.get( option ), values ) >= 0 ) {
8326
+ if ( jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 ) {
8336
8327
 
8337
8328
  // Support: IE6
8338
8329
  // When new option element is added to select box we need to
@@ -8751,8 +8742,11 @@ if ( !support.hrefNormalized ) {
8751
8742
  }
8752
8743
 
8753
8744
  // Support: Safari, IE9+
8754
- // mis-reports the default selected property of an option
8755
- // Accessing the parent's selectedIndex property fixes it
8745
+ // Accessing the selectedIndex property
8746
+ // forces the browser to respect setting selected
8747
+ // on the option
8748
+ // The getter ensures a default option is selected
8749
+ // when in an optgroup
8756
8750
  if ( !support.optSelected ) {
8757
8751
  jQuery.propHooks.selected = {
8758
8752
  get: function( elem ) {
@@ -8767,6 +8761,16 @@ if ( !support.optSelected ) {
8767
8761
  }
8768
8762
  }
8769
8763
  return null;
8764
+ },
8765
+ set: function( elem ) {
8766
+ var parent = elem.parentNode;
8767
+ if ( parent ) {
8768
+ parent.selectedIndex;
8769
+
8770
+ if ( parent.parentNode ) {
8771
+ parent.parentNode.selectedIndex;
8772
+ }
8773
+ }
8770
8774
  }
8771
8775
  };
8772
8776
  }
@@ -9983,6 +9987,11 @@ function getDisplay( elem ) {
9983
9987
  }
9984
9988
 
9985
9989
  function filterHidden( elem ) {
9990
+
9991
+ // Disconnected elements are considered hidden
9992
+ if ( !jQuery.contains( elem.ownerDocument || document, elem ) ) {
9993
+ return true;
9994
+ }
9986
9995
  while ( elem && elem.nodeType === 1 ) {
9987
9996
  if ( getDisplay( elem ) === "none" || elem.type === "hidden" ) {
9988
9997
  return true;
@@ -10349,13 +10358,6 @@ function createActiveXHR() {
10349
10358
 
10350
10359
 
10351
10360
 
10352
- // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
10353
- jQuery.ajaxPrefilter( function( s ) {
10354
- if ( s.crossDomain ) {
10355
- s.contents.script = false;
10356
- }
10357
- } );
10358
-
10359
10361
  // Install script dataType
10360
10362
  jQuery.ajaxSetup( {
10361
10363
  accepts: {
@@ -10542,21 +10544,6 @@ jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
10542
10544
 
10543
10545
 
10544
10546
 
10545
- // Support: Safari 8+
10546
- // In Safari 8 documents created via document.implementation.createHTMLDocument
10547
- // collapse sibling forms: the second one becomes a child of the first one.
10548
- // Because of that, this security measure has to be disabled in Safari 8.
10549
- // https://bugs.webkit.org/show_bug.cgi?id=137337
10550
- support.createHTMLDocument = ( function() {
10551
- if ( !document.implementation.createHTMLDocument ) {
10552
- return false;
10553
- }
10554
- var doc = document.implementation.createHTMLDocument( "" );
10555
- doc.body.innerHTML = "<form></form><form></form>";
10556
- return doc.body.childNodes.length === 2;
10557
- } )();
10558
-
10559
-
10560
10547
  // data: string of html
10561
10548
  // context (optional): If specified, the fragment will be created in this context,
10562
10549
  // defaults to document
@@ -10569,12 +10556,7 @@ jQuery.parseHTML = function( data, context, keepScripts ) {
10569
10556
  keepScripts = context;
10570
10557
  context = false;
10571
10558
  }
10572
-
10573
- // document.implementation stops scripts or inline event handlers from
10574
- // being executed immediately
10575
- context = context || ( support.createHTMLDocument ?
10576
- document.implementation.createHTMLDocument( "" ) :
10577
- document );
10559
+ context = context || document;
10578
10560
 
10579
10561
  var parsed = rsingleTag.exec( data ),
10580
10562
  scripts = !keepScripts && [];
@@ -10656,7 +10638,7 @@ jQuery.fn.load = function( url, params, callback ) {
10656
10638
  // If it fails, this function gets "jqXHR", "status", "error"
10657
10639
  } ).always( callback && function( jqXHR, status ) {
10658
10640
  self.each( function() {
10659
- callback.apply( self, response || [ jqXHR.responseText, status, jqXHR ] );
10641
+ callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
10660
10642
  } );
10661
10643
  } );
10662
10644
  }