opal-jquery 0.4.5 → 0.5.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5fb5f3264743058c0229d35a857bb530f52f936ba393a8822f72c10a2cd858d6
4
- data.tar.gz: bdac53f27ef24689e15caad60921b3fd0df36f2e029af0c7b1b5a88fcf03b069
3
+ metadata.gz: c77dd6b6a0370f6608895f558ed760f3eb3209eaa779cf9d5b0b53ba92025702
4
+ data.tar.gz: 1e5c83c4211904510375188ed3a3439f2e6579007d3e3bdeaf41fd190d2882aa
5
5
  SHA512:
6
- metadata.gz: 3ecc94487c39a9adccbac5d5a7cb8d5308121c39a7ead21bb78749d4936200cb60540c032d7d8db804c8e55b9a54746e9ced788752f3fae1a5ed4ae75d2636fc
7
- data.tar.gz: 65d06f7f03862a84b2862530536cf9c2684540bd7070447871cd458c3a932f730733172ffa7e40c619a0a215288618a5ad433ca8209df50c36418c93fee8142c
6
+ metadata.gz: 3f4338bd0f5c38962cac9b3aba1b39b76849ced9b61702091791296e51e6de9f92e2959becfd6587f62b6fa1fd5af8c951ea473fac13dee22ebba2e329f91b1f
7
+ data.tar.gz: e4eb64e225f66476611cde51b69af4061bf20f47dec47cb1f4cabefdfe27dc3005c6887d93b27d7bfea1d2f08ccfce6861e9f8856ea733cd7847d0d7a82d5428
data/.gitignore CHANGED
@@ -6,3 +6,7 @@ gh-pages
6
6
  /.bundle
7
7
  .yardoc
8
8
  /doc
9
+ .ruby-version
10
+ .ruby-gemset
11
+ .gladiator
12
+ .gladiator-scratchfile
data/CHANGELOG.md CHANGED
@@ -1,6 +1,15 @@
1
- ## [0.5.0](https://github.com/opal/opal-jquery/compare/v0.4.5...HEAD) Unreleased
1
+ ## [0.5.0](https://github.com/opal/opal-jquery/compare/v0.4.6...v0.5.0) 2024-01-05
2
2
 
3
- *see diff*
3
+ * Added `Event#location` (#114)
4
+ * Add `Event#touch_count`; access each point via an optional `index` on `Event#touch_x`/`Event#touch_y` (#117)
5
+ * Add setting to prevent payload automatic processing (#103) **breaking**
6
+ * Remove untaint method for Ruby 3.2 compatibility (#119) **breaking**
7
+
8
+ ## [0.4.6](https://github.com/opal/opal-jquery/compare/v0.4.5...v0.4.6) 2021-10-11
9
+
10
+ * Initialize @@__isReady (#115)
11
+
12
+ * Added `Element#select` (#111)
4
13
 
5
14
  ## [0.4.5](https://github.com/opal/opal-jquery/compare/v0.4.4...v0.4.5) 2021-07-28
6
15
 
data/config.ru CHANGED
@@ -2,6 +2,7 @@ require 'bundler'
2
2
  Bundler.require
3
3
 
4
4
  require 'opal/rspec'
5
+ require 'opal/rspec/sprockets_environment'
5
6
 
6
7
  sprockets_env = Opal::RSpec::SprocketsEnvironment.new
7
8
  run Opal::Server.new(sprockets: sprockets_env) { |s|
@@ -50,6 +50,8 @@ module Browser
50
50
  # end
51
51
  #
52
52
  module DocumentMethods
53
+ @@__isReady = false
54
+
53
55
  `var $ = #{JQUERY_SELECTOR.to_n}` # cache $ for SPEED
54
56
 
55
57
  # Register a block to run once the document/page is ready.
@@ -342,6 +342,9 @@ class Element < `#{JQUERY_CLASS.to_n}`
342
342
 
343
343
  # @!method replace_with(new_content)
344
344
  alias_native :replace_with, :replaceWith
345
+
346
+ # @!method select()
347
+ alias_native :select
345
348
 
346
349
  # @!method submit()
347
350
  alias_native :submit
@@ -163,12 +163,20 @@ class Event
163
163
  `#@native.pageY`
164
164
  end
165
165
 
166
- def touch_x
167
- `#@native.originalEvent.touches[0].pageX`
166
+ def touch_count
167
+ `#@native.originalEvent.touches.length`
168
168
  end
169
169
 
170
- def touch_y
171
- `#@native.originalEvent.touches[0].pageY`
170
+ def touch_x(index = 0)
171
+ `#@native.originalEvent.touches[#{index}].pageX` if index < touch_count
172
+ end
173
+
174
+ def touch_y(index = 0)
175
+ `#@native.originalEvent.touches[#{index}].pageY` if index < touch_count
176
+ end
177
+
178
+ def location
179
+ `#@native.originalEvent.location`
172
180
  end
173
181
 
174
182
  def ctrl_key
@@ -161,14 +161,14 @@ class HTTP
161
161
 
162
162
  @settings.update options
163
163
 
164
- settings, payload = @settings.to_n, @payload
164
+ settings, payload = @settings.to_n, @payload.to_n
165
165
 
166
166
  %x{
167
- if (typeof(#{payload}) === 'string') {
167
+ if (typeof(payload) === 'string' || settings.processData === false) {
168
168
  settings.data = payload;
169
169
  }
170
170
  else if (payload != nil) {
171
- settings.data = payload.$to_json();
171
+ settings.data = JSON.stringify(payload);
172
172
  settings.contentType = 'application/json';
173
173
  }
174
174
 
@@ -1,5 +1,5 @@
1
1
  module Opal
2
2
  module JQuery
3
- VERSION = '0.4.5'
3
+ VERSION = '0.5.0'
4
4
  end
5
5
  end
data/lib/opal/jquery.rb CHANGED
@@ -9,5 +9,5 @@ else
9
9
  require 'opal'
10
10
  require 'opal/jquery/version'
11
11
 
12
- Opal.append_path File.expand_path('../..', __FILE__).untaint
12
+ Opal.append_path File.expand_path('../..', __FILE__)
13
13
  end
data/opal-jquery.gemspec CHANGED
@@ -4,11 +4,11 @@ require File.expand_path('../lib/opal/jquery/version', __FILE__)
4
4
  Gem::Specification.new do |s|
5
5
  s.name = 'opal-jquery'
6
6
  s.version = Opal::JQuery::VERSION
7
- s.authors = ['Adam Beynon', 'Elia Schito']
7
+ s.authors = ['Adam Beynon', 'Elia Schito', 'Andy Maleh']
8
8
  s.email = 'elia@schito.me'
9
9
  s.homepage = 'https://github.com/opal/opal-jquery#readme'
10
10
  s.summary = 'Opal access to jQuery'
11
- s.description = 'Opal DOM library for jQuery'
11
+ s.description = 'Opal DOM library for jQuery (Use jQuery with Ruby code)'
12
12
 
13
13
  s.files = `git ls-files`.split("\n")
14
14
  s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
metadata CHANGED
@@ -1,15 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opal-jquery
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.5
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Beynon
8
8
  - Elia Schito
9
+ - Andy Maleh
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2021-07-28 00:00:00.000000000 Z
13
+ date: 2024-01-06 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: opal
@@ -99,7 +100,7 @@ dependencies:
99
100
  - - ">="
100
101
  - !ruby/object:Gem::Version
101
102
  version: '0'
102
- description: Opal DOM library for jQuery
103
+ description: Opal DOM library for jQuery (Use jQuery with Ruby code)
103
104
  email: elia@schito.me
104
105
  executables: []
105
106
  extensions: []
@@ -186,7 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
186
187
  - !ruby/object:Gem::Version
187
188
  version: '0'
188
189
  requirements: []
189
- rubygems_version: 3.2.15
190
+ rubygems_version: 3.3.6
190
191
  signing_key:
191
192
  specification_version: 4
192
193
  summary: Opal access to jQuery