unpoly-rails 0.61.0 → 0.61.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


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

@@ -74,7 +74,7 @@ up.fragment = do ->
74
74
 
75
75
  \#\#\# Example
76
76
 
77
- Let's say your curent HTML looks like this:
77
+ Let's say your current HTML looks like this:
78
78
 
79
79
  <div class="one">old one</div>
80
80
  <div class="two">old two</div>
@@ -314,7 +314,7 @@ up.fragment = do ->
314
314
 
315
315
  \#\#\# Example
316
316
 
317
- Let's say your curent HTML looks like this:
317
+ Let's say your current HTML looks like this:
318
318
 
319
319
  <div class="one">old one</div>
320
320
  <div class="two">old two</div>
@@ -826,7 +826,10 @@ up.fragment = do ->
826
826
  wipe = ->
827
827
  parent = element.parentNode
828
828
  up.syntax.clean(element)
829
- e.remove(element)
829
+ if up.browser.canJQuery()
830
+ jQuery(element).remove()
831
+ else
832
+ e.remove(element)
830
833
  emitFragmentDestroyed(element, { parent: parent, log: options.log })
831
834
 
832
835
  animate().then(wipe)
@@ -16,7 +16,7 @@ This makes for an unfriendly experience:
16
16
  - State changes caused by AJAX updates get lost during the page transition.
17
17
  - Unsaved form changes get lost during the page transition.
18
18
  - The JavaScript VM is reset during the page transition.
19
- - If the page layout is composed from multiple srollable containers
19
+ - If the page layout is composed from multiple scrollable containers
20
20
  (e.g. a pane view), the scroll positions get lost during the page transition.
21
21
  - The user sees a "flash" as the browser loads and renders the new page,
22
22
  even if large portions of the old and new page are the same (navigation, layout, etc.).
@@ -288,7 +288,7 @@ up.modal = do ->
288
288
  var link = document.querySelector('a')
289
289
  up.modal.follow(link)
290
290
 
291
- Any option attributes for [`a[up-modal]`](/a.up-modal) will be honored.
291
+ Any option attributes for [`a[up-modal]`](/a-up-modal) will be honored.
292
292
 
293
293
  Emits events [`up:modal:open`](/up:modal:open) and [`up:modal:opened`](/up:modal:opened).
294
294
 
@@ -650,7 +650,7 @@ up.modal = do ->
650
650
 
651
651
  Clicking would request the path `/blog` and select `.blog-list` from
652
652
  the HTML response. Unpoly will dim the page
653
- and place the matching `.blog-list` tag will be placed in
653
+ and place the matching `.blog-list` tag in
654
654
  a modal dialog.
655
655
 
656
656
  @selector a[up-modal]
@@ -215,7 +215,7 @@ up.syntax = do ->
215
215
  ###**
216
216
  Registers a [compiler](/up.compiler) that is run before all other compilers.
217
217
 
218
- Use `up.macro()` to register a compiler that sets multiply Unpoly attributes.
218
+ Use `up.macro()` to register a compiler that sets multiple Unpoly attributes.
219
219
 
220
220
  \#\#\# Example
221
221
 
@@ -506,13 +506,37 @@ up.viewport = do ->
506
506
 
507
507
  The scroll positions will be associated with the current URL.
508
508
  They can later be restored by calling [`up.viewport.restoreScroll()`](/up.viewport.restoreScroll)
509
- at the same URL.
509
+ at the same URL, or by following a link with an [`[up-restore-scroll]`](/a-up-follow#up-restore-scroll)
510
+ attribute.
510
511
 
511
- Unpoly automatically saves scroll positions whenever a fragment was updated on the page.
512
+ Unpoly automatically saves scroll positions before a [fragment update](/up.replace)
513
+ you will rarely need to call this function yourself.
514
+
515
+ \#\#\# Examples
516
+
517
+ Should you need to save the current scroll positions outside of a [fragment update](/up.replace),
518
+ you may call:
519
+
520
+ up.viewport.saveScroll()
521
+
522
+ Instead of saving the current scroll positions for the current URL, you may also pass another
523
+ url or vertical scroll positionsfor each viewport:
524
+
525
+ up.viewport.saveScroll({
526
+ url: '/inbox',
527
+ tops: {
528
+ 'body': 0,
529
+ '.sidebar', 100,
530
+ '.main', 320
531
+ }
532
+ })
512
533
 
513
534
  @function up.viewport.saveScroll
514
535
  @param {string} [options.url]
536
+ The URL for which to save scroll positions.
537
+ If omitted, the current browser location is used.
515
538
  @param {Object<string, number>} [options.tops]
539
+ An object mapping viewport selectors to vertical scroll positions in pixels.
516
540
  @experimental
517
541
  ###
518
542
  saveScroll = (options = {}) ->
@@ -4,6 +4,6 @@ module Unpoly
4
4
  # The current version of the unpoly-rails gem.
5
5
  # This version number is also used for releases of the Unpoly
6
6
  # frontend code.
7
- VERSION = '0.61.0'
7
+ VERSION = '0.61.1'
8
8
  end
9
9
  end
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unpoly",
3
- "version": "0.61.0",
3
+ "version": "0.61.1",
4
4
  "description": "Unobtrusive JavaScript framework",
5
5
  "main": "dist/unpoly.js",
6
6
  "files": [
@@ -14,11 +14,9 @@ gem 'bower-rails'
14
14
  gem 'bootstrap-sass', '~> 3.3'
15
15
  gem 'rake', '< 11'
16
16
 
17
- # Jasmine spec runner won't boot with a more modern version of sprockets.
18
- # It crashes with an "asset not precompiled" error.
19
17
  gem 'tilt', '=1.4.1'
20
- gem 'sprockets-rails', '=2.2.4'
21
- gem 'sprockets', '=2.12.3'
18
+ gem 'sprockets-rails', '~> 3.2.1'
19
+ gem 'sprockets', '~> 3.7.2'
22
20
 
23
21
  group :development, :test do
24
22
  gem 'byebug'
@@ -62,7 +62,7 @@ GEM
62
62
  autoprefixer-rails (>= 5.2.1)
63
63
  sass (>= 3.3.4)
64
64
  bower-rails (0.9.2)
65
- builder (3.2.3)
65
+ builder (3.2.4)
66
66
  byebug (3.5.1)
67
67
  columnize (~> 0.8)
68
68
  debugger-linecache (~> 1.2)
@@ -75,8 +75,8 @@ GEM
75
75
  execjs
76
76
  coffee-script-source (1.12.2)
77
77
  columnize (0.9.0)
78
- concurrent-ruby (1.1.4)
79
- crass (1.0.4)
78
+ concurrent-ruby (1.1.6)
79
+ crass (1.0.6)
80
80
  debug_inspector (0.0.2)
81
81
  debugger-linecache (1.2.0)
82
82
  diff-lcs (1.2.5)
@@ -92,7 +92,6 @@ GEM
92
92
  haml (>= 3.1, < 5.0)
93
93
  html2haml (>= 1.0.1)
94
94
  railties (>= 4.0.1)
95
- hike (1.2.3)
96
95
  hpricot (0.8.6)
97
96
  html2haml (1.0.1)
98
97
  erubis (~> 2.7.0)
@@ -102,25 +101,24 @@ GEM
102
101
  i18n (0.9.5)
103
102
  concurrent-ruby (~> 1.0)
104
103
  jasmine-core (2.99.2)
105
- jquery-rails (4.3.1)
104
+ jquery-rails (4.3.5)
106
105
  rails-dom-testing (>= 1, < 3)
107
106
  railties (>= 4.2.0)
108
107
  thor (>= 0.14, < 2.0)
109
108
  json (1.8.6)
110
109
  libv8 (3.16.14.3)
111
- loofah (2.2.3)
110
+ loofah (2.4.0)
112
111
  crass (~> 1.0.2)
113
112
  nokogiri (>= 1.5.9)
114
113
  mail (2.6.3)
115
114
  mime-types (>= 1.16, < 3)
116
115
  mime-types (2.99)
117
116
  mini_portile2 (2.4.0)
118
- minitest (5.11.3)
119
- multi_json (1.13.1)
120
- nokogiri (1.9.1)
117
+ minitest (5.14.0)
118
+ nokogiri (1.10.9)
121
119
  mini_portile2 (~> 2.4.0)
122
120
  phantomjs (2.1.1.0)
123
- rack (1.6.11)
121
+ rack (1.6.13)
124
122
  rack-test (0.6.3)
125
123
  rack (>= 1.0)
126
124
  rails (4.2.0)
@@ -140,8 +138,8 @@ GEM
140
138
  activesupport (>= 4.2.0, < 5.0)
141
139
  nokogiri (~> 1.6)
142
140
  rails-deprecated_sanitizer (>= 1.0.1)
143
- rails-html-sanitizer (1.0.4)
144
- loofah (~> 2.2, >= 2.2.2)
141
+ rails-html-sanitizer (1.3.0)
142
+ loofah (~> 2.3)
145
143
  railties (4.2.0)
146
144
  actionpack (= 4.2.0)
147
145
  activesupport (= 4.2.0)
@@ -177,23 +175,21 @@ GEM
177
175
  tilt (>= 1.1, < 3)
178
176
  sexp_processor (4.4.4)
179
177
  slop (3.6.0)
180
- sprockets (2.12.3)
181
- hike (~> 1.2)
182
- multi_json (~> 1.0)
183
- rack (~> 1.0)
184
- tilt (~> 1.1, != 1.3.0)
185
- sprockets-rails (2.2.4)
186
- actionpack (>= 3.0)
187
- activesupport (>= 3.0)
188
- sprockets (>= 2.8, < 4.0)
178
+ sprockets (3.7.2)
179
+ concurrent-ruby (~> 1.0)
180
+ rack (> 1, < 3)
181
+ sprockets-rails (3.2.1)
182
+ actionpack (>= 4.0)
183
+ activesupport (>= 4.0)
184
+ sprockets (>= 3.0.0)
189
185
  sqlite3 (1.3.10)
190
186
  therubyracer (0.12.1)
191
187
  libv8 (~> 3.16.14.0)
192
188
  ref
193
- thor (0.20.3)
189
+ thor (1.0.1)
194
190
  thread_safe (0.3.6)
195
191
  tilt (1.4.1)
196
- tzinfo (1.2.5)
192
+ tzinfo (1.2.7)
197
193
  thread_safe (~> 0.1)
198
194
  uglifier (2.6.0)
199
195
  execjs (>= 0.3.0)
@@ -220,8 +216,8 @@ DEPENDENCIES
220
216
  rake (< 11)
221
217
  rspec-rails
222
218
  sass-rails (~> 5.0)
223
- sprockets (= 2.12.3)
224
- sprockets-rails (= 2.2.4)
219
+ sprockets (~> 3.7.2)
220
+ sprockets-rails (~> 3.2.1)
225
221
  sqlite3
226
222
  therubyracer
227
223
  tilt (= 1.4.1)
@@ -230,4 +226,4 @@ DEPENDENCIES
230
226
  web-console (~> 2.0)
231
227
 
232
228
  BUNDLED WITH
233
- 1.16.4
229
+ 1.17.3
@@ -25,6 +25,28 @@ describe 'up.form', ->
25
25
  results = up.form.fields(textArea)
26
26
  expect(results).toMatchList([textArea])
27
27
 
28
+ it 'ignores fields outside the given form', ->
29
+ form1 = fixture('form')
30
+ form1Field = e.affix(form1, 'input[type=text]')
31
+ form2 = fixture('form')
32
+ form2Field = e.affix(form2, 'input[type=text]')
33
+ results = up.form.fields(form1)
34
+ expect(results).toMatchList([form1Field])
35
+
36
+ it "includes fields outside the form with a [form] attribute matching the given form's ID", ->
37
+ form = fixture('form#form-id')
38
+ insideField = e.affix(form, 'input[type=text]')
39
+ outsideField = fixture('input[type=text][form=form-id]')
40
+ results = up.form.fields(form)
41
+ expect(results).toMatchList([insideField, outsideField])
42
+
43
+ it "does not return duplicate fields if a field with a matching [form] attribute is also a child of the form", ->
44
+ form = fixture('form#form-id')
45
+ field = e.affix(form, 'input[type=text][form=form-id]')
46
+ results = up.form.fields(form)
47
+ expect(results).toMatchList([field])
48
+
49
+
28
50
  describe 'up.observe', ->
29
51
 
30
52
  beforeEach ->
@@ -877,6 +899,23 @@ describe 'up.form', ->
877
899
  Trigger.change($field)
878
900
  next => expect(submitSpy).toHaveBeenCalled()
879
901
 
902
+ it 'submits the form when a change is observed on a container for a radio button group', asyncSpec (next) ->
903
+ form = fixture('form')
904
+ group = e.affix(form, '.group[up-autosubmit][up-delay=0]')
905
+ radio1 = e.affix(group, 'input[type=radio][name=foo][value=1]')
906
+ radio2 = e.affix(group, 'input[type=radio][name=foo][value=2]')
907
+ up.hello(form)
908
+ submitSpy = up.form.knife.mock('submit').and.returnValue(Promise.reject())
909
+ Trigger.clickSequence(radio1)
910
+ next =>
911
+ expect(submitSpy.calls.count()).toBe(1)
912
+ Trigger.clickSequence(radio2)
913
+ next =>
914
+ expect(submitSpy.calls.count()).toBe(2)
915
+ Trigger.clickSequence(radio1)
916
+ next =>
917
+ expect(submitSpy.calls.count()).toBe(3)
918
+
880
919
  describe 'form[up-autosubmit]', ->
881
920
 
882
921
  it 'submits the form when a change is observed in any of its fields', asyncSpec (next) ->
@@ -2533,6 +2533,15 @@ describe 'up.fragment', ->
2533
2533
  )
2534
2534
  expect($element).toBeDetached()
2535
2535
 
2536
+ it 'removes element-related data from the global jQuery cache (bugfix)', asyncSpec (next) ->
2537
+ $element = $fixture('.element')
2538
+ $element.data('foo', { foo: '1' })
2539
+ expect($element.data('foo')).toEqual({ foo: '1'})
2540
+ up.destroy($element)
2541
+
2542
+ next ->
2543
+ expect($element.data('foo')).toBeMissing()
2544
+
2536
2545
  describe 'up.reload', ->
2537
2546
 
2538
2547
  describeCapability 'canPushState', ->
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unpoly-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.61.0
4
+ version: 0.61.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henning Koch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-20 00:00:00.000000000 Z
11
+ date: 2020-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -400,8 +400,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
400
400
  - !ruby/object:Gem::Version
401
401
  version: '0'
402
402
  requirements: []
403
- rubyforge_project:
404
- rubygems_version: 2.7.6
403
+ rubygems_version: 3.1.2
405
404
  signing_key:
406
405
  specification_version: 4
407
406
  summary: Rails bindings for Unpoly, the unobtrusive JavaScript framework