opal-browser 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/build.yml +28 -17
  3. data/.github/workflows/pages.yml +21 -0
  4. data/.gitignore +1 -0
  5. data/CHANGELOG.md +7 -0
  6. data/Gemfile +15 -5
  7. data/Rakefile +32 -9
  8. data/bin/rake +7 -0
  9. data/bin/setup +8 -0
  10. data/config.ru +19 -12
  11. data/opal/browser/dom/element/attributes.rb +2 -0
  12. data/opal/browser/dom/element/button.rb +2 -0
  13. data/opal/browser/dom/element/custom.rb +2 -1
  14. data/opal/browser/dom/element/data.rb +2 -0
  15. data/opal/browser/dom/element/editable.rb +2 -0
  16. data/opal/browser/dom/element/form.rb +25 -1
  17. data/opal/browser/dom/element/iframe.rb +2 -0
  18. data/opal/browser/dom/element/image.rb +6 -15
  19. data/opal/browser/dom/element/input.rb +7 -19
  20. data/opal/browser/dom/element/media.rb +4 -3
  21. data/opal/browser/dom/element/offset.rb +2 -0
  22. data/opal/browser/dom/element/scroll.rb +2 -0
  23. data/opal/browser/dom/element/select.rb +4 -7
  24. data/opal/browser/dom/element/size.rb +6 -12
  25. data/opal/browser/dom/element/template.rb +2 -0
  26. data/opal/browser/dom/element/textarea.rb +3 -3
  27. data/opal/browser/dom/element.rb +4 -0
  28. data/opal/browser/event/animation.rb +5 -7
  29. data/opal/browser/event/audio_processing.rb +5 -11
  30. data/opal/browser/event/base.rb +4 -6
  31. data/opal/browser/event/before_unload.rb +2 -0
  32. data/opal/browser/event/clipboard.rb +4 -7
  33. data/opal/browser/event/close.rb +4 -7
  34. data/opal/browser/event/composition.rb +4 -7
  35. data/opal/browser/event/custom.rb +5 -3
  36. data/opal/browser/event/data_transfer.rb +3 -1
  37. data/opal/browser/event/device_light.rb +3 -3
  38. data/opal/browser/event/device_motion.rb +6 -15
  39. data/opal/browser/event/device_orientation.rb +6 -15
  40. data/opal/browser/event/device_proximity.rb +5 -11
  41. data/opal/browser/event/drag.rb +6 -14
  42. data/opal/browser/event/focus.rb +4 -7
  43. data/opal/browser/event/gamepad.rb +3 -1
  44. data/opal/browser/event/hash_change.rb +4 -7
  45. data/opal/browser/event/keyboard.rb +2 -0
  46. data/opal/browser/event/message.rb +5 -11
  47. data/opal/browser/event/mouse.rb +20 -65
  48. data/opal/browser/event/page_transition.rb +3 -3
  49. data/opal/browser/event/pop_state.rb +3 -1
  50. data/opal/browser/event/progress.rb +5 -11
  51. data/opal/browser/event/sensor.rb +2 -0
  52. data/opal/browser/event/storage.rb +7 -19
  53. data/opal/browser/event/touch.rb +2 -0
  54. data/opal/browser/event/ui.rb +4 -7
  55. data/opal/browser/event/wheel.rb +5 -11
  56. data/opal/browser/support.rb +21 -33
  57. data/opal/browser/version.rb +1 -1
  58. data/opal-browser.gemspec +23 -18
  59. data/spec/browser_runner.rb.erb +14 -0
  60. data/spec/browser_runner_compat.rb +29 -0
  61. data/{index.html.erb → spec/browser_runner_index.html.erb} +1 -5
  62. data/spec/database/sql_spec.rb +1 -1
  63. data/spec/event_spec.rb +43 -0
  64. data/spec/immediate_spec.rb +1 -1
  65. data/spec/runner.rb +3 -3
  66. data/spec/spec_helper_promise.rb.erb +13 -5
  67. metadata +206 -34
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ca31ac16a859cb8e8e2d033f9654d73f69af51fb370b84c4eea90c11d854b591
4
- data.tar.gz: cf292f8f778e76a8a0552a57d608cafbd975653df39df2f79e6d0ea1f8600d5e
3
+ metadata.gz: fec32c82d8c78a088dd1f6f201462f25c4d98f3d4bb22047f4894f7a90b847bd
4
+ data.tar.gz: 31e09ce6cfe8a639ad860262680dfd27de0cda2d0d541bc14cd40724b6ddcc99
5
5
  SHA512:
6
- metadata.gz: 60b6ebdb57718727af8443be34513c614d49d6a182a7a1189bf37ecf2998e8895a8ed6b321455be04e45ce94815e762d93cd1ad3d35b9bf8c1257b5a9face39e
7
- data.tar.gz: 0eda48ea9ba83c04929266bb2c664290d22389a6ff16aef4faab3b4a055c7510ed2e9734d6f6d7b409a79ecb56086627df559ea2c0d8ce3281a9e13472731adc
6
+ metadata.gz: e4dbd18553366696f0b1596e4638247deeb1931a0c5e17f192fb3bc6ffae4ddea1ddeb8f694be4d02188ab7783678669550b7677e9cd5ac77ef3553c61b814fd
7
+ data.tar.gz: 8ab8d7e91729550272d613c3a028e87c1c325e5f5e6cc8e98c2f13a12287649484586f7b34ce083e9d5bfed71a4f4991e5e60d5afe4ab0078bbc004a7487413e
@@ -17,19 +17,29 @@ jobs:
17
17
  combo:
18
18
  - name: Chromium/Linux/Opal-master
19
19
  opal: master
20
- - name: Chromium/Linux/Opal-1.4
21
- opal: 1.4
22
- - name: Chromium/Linux/Opal-1.3/PromiseV2
23
- opal: 1.3
20
+ opal-rspec: '1.1'
21
+ - name: Chromium/Linux/Opal-1.8
22
+ opal: 1.8
23
+ opal-rspec: '1.1'
24
+ - name: Chromium/Linux/Opal-1.7
25
+ opal: 1.7
26
+ opal-rspec: '1.0'
27
+ - name: Chromium/Linux/Opal-1.5
28
+ opal: 1.5
29
+ - name: Chromium/Linux/Opal-1.5/PromiseV2
30
+ opal: 1.5
24
31
  promise: v2
25
32
  - name: Chromium/Linux/Opal-1.3
26
33
  opal: 1.3
27
- - name: Chromium/Linux/Opal-1.0
28
- opal: '1.0'
29
- - name: Chromium/Linux/Ruby-2.7
30
- ruby: 2.7
31
- - name: Chromium/Linux/Ruby-2.6
32
- ruby: 2.6
34
+ - name: Chromium/Linux/Opal-1.0/Ruby-3.1
35
+ opal: 1.1
36
+ ruby: 3.1
37
+ - name: Chromium/Linux/Ruby-head
38
+ ruby: head
39
+ - name: Chromium/Linux/Ruby-3.1
40
+ ruby: '3.1'
41
+ - name: Chromium/Linux/Ruby-3.0
42
+ ruby: '3.0'
33
43
  - name: Firefox/Linux
34
44
  browser: gecko
35
45
  - name: Chromium/Windows
@@ -55,21 +65,22 @@ jobs:
55
65
  - uses: actions/checkout@v2
56
66
  - name: set environment variables
57
67
  run: |
58
- echo "OPAL_VERSION=${{ matrix.combo.opal || '1.3' }}" >> $GITHUB_ENV
68
+ echo "OPAL_VERSION=${{ matrix.combo.opal || '1.8' }}" >> $GITHUB_ENV
69
+ echo "OPAL_RSPEC_VERSION=${{ matrix.combo.opal-rspec || '' }}" >> $GITHUB_ENV
59
70
  echo "OPAL_BROWSER_PROMISE=${{ matrix.combo.promise || 'v1' }}" >> $GITHUB_ENV
60
71
  - uses: ruby/setup-ruby@v1
61
72
  with:
62
- ruby-version: ${{ matrix.combo.ruby || '3.0' }}
73
+ ruby-version: ${{ matrix.combo.ruby || '3.2' }}
63
74
  - run: bundle lock
64
75
  - uses: actions/cache@v2
65
76
  with:
66
77
  path: ./vendor/bundle
67
- key: ${{ runner.os }}-${{ matrix.combo.ruby || '3.0' }}-gems-${{ matrix.combo.opal || '1.3' }}-${{ github.ref }}-${{ hashFiles('**/Gemfile.lock') }}
78
+ key: ${{ runner.os }}-${{ matrix.combo.ruby || '3.2' }}-gems-${{ matrix.combo.opal || '1.8' }}-${{ github.ref }}-${{ hashFiles('**/Gemfile.lock') }}
68
79
  restore-keys: |
69
- ${{ runner.os }}-${{ matrix.combo.ruby || '3.0' }}-gems-${{ matrix.combo.opal || '1.3' }}-${{ github.ref }}
70
- ${{ runner.os }}-${{ matrix.combo.ruby || '3.0' }}-gems-${{ matrix.combo.opal || '1.3' }}-master
71
- ${{ runner.os }}-${{ matrix.combo.ruby || '3.0' }}-gems-${{ matrix.combo.opal || '1.3' }}-
72
- ${{ runner.os }}-${{ matrix.combo.ruby || '3.0' }}-gems-
80
+ ${{ runner.os }}-${{ matrix.combo.ruby || '3.2' }}-gems-${{ matrix.combo.opal || '1.8' }}-${{ github.ref }}
81
+ ${{ runner.os }}-${{ matrix.combo.ruby || '3.2' }}-gems-${{ matrix.combo.opal || '1.8' }}-master
82
+ ${{ runner.os }}-${{ matrix.combo.ruby || '3.2' }}-gems-${{ matrix.combo.opal || '1.8' }}-
83
+ ${{ runner.os }}-${{ matrix.combo.ruby || '3.2' }}-gems-
73
84
  - name: bundle install
74
85
  run: |
75
86
  bundle config path $PWD/vendor/bundle
@@ -0,0 +1,21 @@
1
+ name: Build and Deploy GH Pages
2
+ on: [push]
3
+ jobs:
4
+ pages:
5
+ concurrency: ci-${{ github.ref }} # Recommended if you intend to make multiple deployments in quick succession.
6
+ runs-on: ubuntu-latest
7
+ steps:
8
+ - name: Checkout 🛎️
9
+ uses: actions/checkout@v2
10
+ - name: Setup Ruby
11
+ uses: ruby/setup-ruby@v1
12
+ with:
13
+ ruby-version: "3.0" # Not needed with a .ruby-version file
14
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
15
+ - name: Install and Build 🔧 # This example project is built using npm and outputs the result to the 'build' folder. Replace with the commands required to build your project, or remove this step entirely if your site is pre-built.
16
+ run: bundle exec rake build_gh_pages
17
+ - name: Deploy 🚀
18
+ uses: JamesIves/github-pages-deploy-action@v4.2.3
19
+ with:
20
+ branch: gh-pages # The branch the action should deploy to.
21
+ folder: gh-pages # The folder the action should deploy.
data/.gitignore CHANGED
@@ -6,3 +6,4 @@ doc
6
6
  .yardoc
7
7
  screenshot.png
8
8
  /pkg
9
+ /gh-pages
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## 0.3.4
2
+ * Element#children=
3
+ * Support more methods on Media
4
+ * Event::Custom to support non-enumerable properties
5
+ * DOM::Element::Form: #valid?, #request_submit, #ajax_submit
6
+ * Compatibility for Opal-RSpec 1.0
7
+
1
8
  ## 0.3.3
2
9
  * Compatibility fix for Opal 1.4
3
10
 
data/Gemfile CHANGED
@@ -6,25 +6,35 @@ gem 'rake'
6
6
  gem 'rack'
7
7
  gem 'sinatra'
8
8
  gem 'sinatra-websocket'
9
- gem 'opal-rspec'
10
- gem 'opal-sprockets'
9
+ case ENV['OPAL_RSPEC_VERSION']
10
+ when nil, ''
11
+ gem 'opal-rspec'
12
+ when /\./
13
+ gem 'opal-rspec', "~> #{ENV['OPAL_RSPEC_VERSION']}.0a"
14
+ else
15
+ gem 'opal-rspec', github: 'opal/opal-rspec', ref: ENV['OPAL_RSPEC_VERSION'], submodules: true
16
+ end
11
17
  # Force build of eventmachine... I wish we could find a way to not use
12
18
  # this unmaintained library anymore.
13
19
  gem 'eventmachine', github: 'eventmachine/eventmachine'
14
20
  gem 'thin', github: 'macournoyer/thin' unless RUBY_PLATFORM =~ /mingw/
15
21
 
16
22
  # runner
17
- gem 'selenium-webdriver', require: false
23
+ gem 'selenium-webdriver', '>= 4.14.0', require: false
18
24
  gem 'rest-client', require: false
19
- gem 'webdrivers', require: false
20
25
  gem 'rexml', require: false
26
+ gem 'ffi'
21
27
 
22
28
  # browser
23
29
  case ENV['OPAL_VERSION']
24
- when nil
30
+ when nil, ''
31
+ # noop
32
+ when ->(path) { File.exist? path }
33
+ gem 'opal', path: ENV['OPAL_VERSION']
25
34
  when /\./
26
35
  gem 'opal', "~> #{ENV['OPAL_VERSION']}.0a"
27
36
  else
28
37
  gem 'opal', github: 'opal/opal', ref: ENV['OPAL_VERSION']
29
38
  end
30
39
 
40
+ gem 'opal-sprockets'
data/Rakefile CHANGED
@@ -2,9 +2,6 @@ require 'bundler'
2
2
  Bundler.require
3
3
  require 'bundler/gem_tasks'
4
4
 
5
- require 'webdrivers'
6
- load 'webdrivers/Rakefile'
7
-
8
5
  require 'opal/rspec/rake_task'
9
6
  Opal::RSpec::RakeTask.new(:broken_rspec) do |_, task|
10
7
  task.default_path = 'spec'
@@ -14,12 +11,8 @@ end
14
11
  task(:nil) {}
15
12
 
16
13
  %w[chrome edge gecko safari].each do |i|
17
- dependency = nil
18
- if %w[chrome edge gecko].include? i
19
- dependency = "webdrivers:#{i}driver:update"
20
- end
21
14
  desc "Run Selenium tests with #{i}"
22
- task :"selenium_#{i}" => dependency do
15
+ task :"selenium_#{i}" do
23
16
  server = Process.spawn("bundle", "exec", "rackup")
24
17
  at_exit { Process.kill(9, server) rescue nil }
25
18
  sleep 2
@@ -30,4 +23,34 @@ task(:nil) {}
30
23
  end
31
24
  end
32
25
 
33
- task :default => :selenium_chrome
26
+ task :default => :selenium_chrome
27
+
28
+ task :build_gh_pages do
29
+ require 'fileutils'
30
+
31
+ output_dir = __dir__+"/gh-pages/examples/"
32
+ FileUtils.mkdir_p output_dir
33
+
34
+ Dir['examples/*'].reject { |i| i =~ /integrations|svg/ }.each do |example_path|
35
+ example = File.basename(example_path)
36
+
37
+ output_example_dir = output_dir+"/"+example
38
+ FileUtils.mkdir_p output_example_dir
39
+
40
+ Dir.chdir(example_path) do
41
+ Bundler.with_unbundled_env do
42
+ `bundle install`
43
+ `bundle exec opal -qopal-browser -c app/application.rb > #{output_example_dir}/app.js`
44
+ end
45
+ File.write("#{output_example_dir}/index.html", <<~HTML)
46
+ <!DOCTYPE html>
47
+ <html>
48
+ <head></head>
49
+ <body>
50
+ <script src="app.js"></script>
51
+ </body>
52
+ </html>
53
+ HTML
54
+ end
55
+ end
56
+ end
data/bin/rake ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "rubygems"
5
+ require "bundler/setup"
6
+
7
+ load Gem.bin_path("rake", "rake")
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ gem install bundler --conservative
7
+
8
+ bundle update
data/config.ru CHANGED
@@ -3,17 +3,24 @@ Bundler.require
3
3
 
4
4
  apps = []
5
5
 
6
- sprockets_env = Opal::RSpec::SprocketsEnvironment.new(spec_pattern = 'spec/**/*_spec.{rb,opal}',
7
- spec_exclude_pattern = nil,
8
- spec_files = nil,
9
- default_path = 'spec')
10
-
11
- apps << Opal::Sprockets::Server.new(sprockets: sprockets_env) { |s|
12
- s.main = 'opal/rspec/sprockets_runner'
13
- s.append_path 'spec'
14
- s.index_path = 'index.html.erb'
15
- s.debug = true
16
- }
6
+ require 'opal/rspec'
7
+
8
+ Opal::Config.arity_check_enabled = true
9
+ Opal::Config.enable_source_location = true if Opal::Config.respond_to? :enable_file_source_location=
10
+ Opal::Config.enable_file_source_embed = true if Opal::Config.respond_to? :enable_file_source_embed=
11
+
12
+ Opal.append_path "#{__dir__}/spec"
13
+
14
+ apps << Opal::SimpleServer.new do |s|
15
+ require_relative './spec/browser_runner_compat'
16
+
17
+ $locator = Opal::RSpec::Locator.new(
18
+ pattern: 'spec/**/*_spec.{rb,opal}',
19
+ default_path: 'spec'
20
+ )
21
+
22
+ s.index_path = 'spec/browser_runner_index.html.erb'
23
+ end
17
24
 
18
25
  apps << Class.new(Sinatra::Base) {
19
26
  get '/http' do
@@ -78,4 +85,4 @@ apps << Class.new(Sinatra::Base) {
78
85
  end
79
86
  }
80
87
 
81
- run Rack::Cascade.new(apps)
88
+ run Rack::Cascade.new(apps.reverse)
@@ -1,3 +1,5 @@
1
+ # backtick_javascript: true
2
+
1
3
  module Browser; module DOM; class Element < Node
2
4
 
3
5
  class Attributes
@@ -1,3 +1,5 @@
1
+ # backtick_javascript: true
2
+
1
3
  module Browser; module DOM; class Element < Node
2
4
 
3
5
  class Button < Element
@@ -1,5 +1,6 @@
1
1
  # use_strict: true
2
2
  # helpers: truthy
3
+ # backtick_javascript: true
3
4
 
4
5
  module Browser; module DOM; class Element < Node
5
6
 
@@ -174,4 +175,4 @@ class Custom < Element
174
175
  include Mixin
175
176
  end
176
177
 
177
- end; end; end
178
+ end; end; end
@@ -1,3 +1,5 @@
1
+ # backtick_javascript: true
2
+
1
3
  module Browser; module DOM; class Element < Node
2
4
 
3
5
  class Data
@@ -1,3 +1,5 @@
1
+ # backtick_javascript: true
2
+
1
3
  module Browser; module DOM
2
4
 
3
5
  class Element < Node
@@ -1,3 +1,5 @@
1
+ # backtick_javascript: true
2
+
1
3
  module Browser; module DOM; class Element < Node
2
4
 
3
5
  class Form < Element
@@ -10,11 +12,33 @@ class Form < Element
10
12
  FormData.create(self)
11
13
  end
12
14
 
13
- # Submit a form. This will fire a submit event.
15
+ # Returns true if form is valid, false otherwise
16
+ def valid?
17
+ `#@native.reportValidity()`
18
+ end
19
+
20
+ # Submit a form. This will NOT fire a submit event.
14
21
  def submit
15
22
  `#@native.submit()`
16
23
  end
17
24
 
25
+ # Submit a form, optionally with a button argument.
26
+ # This will fire a submit event.
27
+ def request_submit(submitter = nil)
28
+ if submitter
29
+ `#@native.requestSubmit(#{submitter.to_n})`
30
+ else
31
+ `#@native.requestSubmit()`
32
+ end
33
+ end
34
+
35
+ # Submit a form using AJAX.
36
+ def ajax_submit(&block)
37
+ data = form_data
38
+ data = data.to_h unless encoding == 'multipart/form-data'
39
+ HTTP.send(method, target, form_data, &block)
40
+ end
41
+
18
42
  # Reset a form. This will fire a reset event.
19
43
  def reset
20
44
  `#@native.reset()`
@@ -1,3 +1,5 @@
1
+ # backtick_javascript: true
2
+
1
3
  module Browser; module DOM; class Element < Node
2
4
 
3
5
  class Iframe < Element
@@ -1,23 +1,14 @@
1
+ # backtick_javascript: true
2
+
1
3
  module Browser; module DOM; class Element < Node
2
4
 
3
5
  class Image < Element
4
6
  def_selector "img"
5
7
 
6
- def complete?
7
- `#@native.complete`
8
- end
9
-
10
- def cross?
11
- `#@native.crossOrigin`
12
- end
13
-
14
- def height
15
- `#@native.naturalHeight`
16
- end
17
-
18
- def width
19
- `#@native.naturalWidth`
20
- end
8
+ alias_native :complete?, :complete
9
+ alias_native :cross?, :crossOrigin
10
+ alias_native :height, :naturalHeight
11
+ alias_native :width, :naturalWidth
21
12
  end
22
13
 
23
14
  Img = Image
@@ -1,3 +1,5 @@
1
+ # backtick_javascript: true
2
+
1
3
  module Browser; module DOM; class Element < Node
2
4
 
3
5
  class Input < Element
@@ -14,21 +16,11 @@ class Input < Element
14
16
  }
15
17
  end
16
18
 
17
- def value=(value)
18
- `#@native.value = #{value}`
19
- end
20
-
21
- def name_
22
- `#@native.name`
23
- end
24
-
25
- def type
26
- `#@native.type`
27
- end
28
-
29
- def checked?
30
- `#@native.checked`
31
- end
19
+ alias_native :value=
20
+ alias_native :name_, :name
21
+ alias_native :type
22
+ alias_native :checked?, :checked
23
+ alias_native :enabled?, :enabled
32
24
 
33
25
  def check!
34
26
  `#@native.checked = 'checked'`
@@ -38,10 +30,6 @@ class Input < Element
38
30
  `#@native.checked = ''`
39
31
  end
40
32
 
41
- def enabled?
42
- `#@native.enabled`
43
- end
44
-
45
33
  def disable!
46
34
  `#@native.disabled = 'disabled'`
47
35
  end
@@ -1,9 +1,10 @@
1
1
  module Browser; module DOM; class Element < Node
2
2
 
3
3
  class Media < Element
4
- def play
5
- `#@native.play()`
6
- end
4
+ alias_native :play
5
+ alias_native :pause
6
+ alias_native :time, :currentTime
7
+ alias_native :time=, :currentTime
7
8
  end
8
9
 
9
10
  class Video < Media
@@ -1,3 +1,5 @@
1
+ # backtick_javascript: true
2
+
1
3
  module Browser; module DOM; class Element < Node
2
4
 
3
5
  class Offset
@@ -1,3 +1,5 @@
1
+ # backtick_javascript: true
2
+
1
3
  module Browser; module DOM; class Element < Node
2
4
 
3
5
  # @todo Consider using the new interfaces which allow for optional
@@ -1,3 +1,5 @@
1
+ # backtick_javascript: true
2
+
1
3
  module Browser; module DOM; class Element < Node
2
4
 
3
5
  class Select < Element
@@ -14,9 +16,7 @@ class Select < Element
14
16
  }
15
17
  end
16
18
 
17
- def value= value
18
- `#@native.value = #{value.to_n}`
19
- end
19
+ alias_native :value=
20
20
 
21
21
  def labels
22
22
  NodeSet[Native::Array.new(`#@native.labels`)]
@@ -30,10 +30,7 @@ class Select < Element
30
30
  DOM(`#@native.options[#@native.selectedIndex]`)
31
31
  end
32
32
 
33
- def index
34
- `#@native.selectedIndex`
35
- end
36
-
33
+ alias_native :index, :selectedIndex
37
34
  alias_native :multiple?, :multiple
38
35
  alias_native :required?, :required
39
36
  alias_native :length
@@ -1,6 +1,8 @@
1
1
  module Browser; module DOM; class Element < Node
2
2
 
3
3
  class Size
4
+ include Native::Wrapper
5
+
4
6
  attr_reader :element
5
7
 
6
8
  # @private
@@ -12,9 +14,7 @@ class Size
12
14
 
13
15
  # @!attribute width
14
16
  # @return [Integer] the element width
15
- def width
16
- `#@native.offsetWidth`
17
- end
17
+ alias_native :width, :offsetWidth
18
18
 
19
19
  def width=(value)
20
20
  @element.style[:width] = value
@@ -22,9 +22,7 @@ class Size
22
22
 
23
23
  # @!attribute height
24
24
  # @return [Integer] the element height
25
- def height
26
- `#@native.offsetHeight`
27
- end
25
+ alias_native :height, :offsetHeight
28
26
 
29
27
  def height=(value)
30
28
  @element.style[:height] = value
@@ -32,15 +30,11 @@ class Size
32
30
 
33
31
  # @!attribute client_width
34
32
  # @return [Integer] the content-box width of an element
35
- def client_width
36
- `#@native.clientWidth`
37
- end
33
+ alias_native :client_width, :clientWidth
38
34
 
39
35
  # @!attribute client_height
40
36
  # @return [Integer] the content-box height of an element
41
- def client_height
42
- `#@native.clientHeight`
43
- end
37
+ alias_native :client_height, :clientHeight
44
38
  end
45
39
 
46
40
  end; end; end
@@ -1,3 +1,5 @@
1
+ # backtick_javascript: true
2
+
1
3
  module Browser; module DOM; class Element < Node
2
4
 
3
5
  class Template < Element
@@ -1,3 +1,5 @@
1
+ # backtick_javascript: true
2
+
1
3
  module Browser; module DOM; class Element < Node
2
4
 
3
5
  class Textarea < Element
@@ -14,9 +16,7 @@ class Textarea < Element
14
16
  }
15
17
  end
16
18
 
17
- def value=(value)
18
- `#@native.value = #{value}`
19
- end
19
+ alias_native :value=
20
20
 
21
21
  def clear
22
22
  `#@native.value = ''`
@@ -1,3 +1,5 @@
1
+ # backtick_javascript: true
2
+
1
3
  # Requires are moved to the bottom of this file.
2
4
 
3
5
  module Browser; module DOM
@@ -367,6 +369,8 @@ class Element < Node
367
369
  self << node
368
370
  end
369
371
 
372
+ alias children= inner_dom=
373
+
370
374
  # @!attribute inner_html
371
375
  # @return [String] the inner HTML of the element
372
376
  def inner_html
@@ -1,3 +1,5 @@
1
+ # backtick_javascript: true
2
+
1
3
  module Browser; class Event
2
4
 
3
5
  class Animation < Event
@@ -8,13 +10,9 @@ class Animation < Event
8
10
  end
9
11
 
10
12
  class Definition < Definition
11
- def animation=(value)
12
- `#@native.animationName = #{value}`
13
- end
14
-
15
- def elapsed=(value)
16
- `#@native.elapsedTime = #{value}`
17
- end
13
+ alias_native :name=, :animationName=
14
+ alias_native :animation=, :animationName=
15
+ alias_native :elapsed=, :elapsedTime=
18
16
  end
19
17
 
20
18
  if Browser.supports? 'Event.constructor'
@@ -1,3 +1,5 @@
1
+ # backtick_javascript: true
2
+
1
3
  module Browser; class Event
2
4
 
3
5
  class AudioProcessing < Event
@@ -8,17 +10,9 @@ class AudioProcessing < Event
8
10
  end
9
11
 
10
12
  class Definition < Definition
11
- def time=(value)
12
- `#@native.playbackTime = #{value}`
13
- end
14
-
15
- def input=(value)
16
- `#@native.inputBuffer = #{value}`
17
- end
18
-
19
- def output=(value)
20
- `#@native.outputBuffer = #{value}`
21
- end
13
+ alias_native :time=, :playbackTime=
14
+ alias_native :input=, :inputBuffer=
15
+ alias_native :output=, :outputBuffer=
22
16
  end
23
17
 
24
18
  if Browser.supports? 'Event.constructor'
@@ -1,3 +1,5 @@
1
+ # backtick_javascript: true
2
+
1
3
  module Browser
2
4
 
3
5
  class Event
@@ -16,14 +18,10 @@ class Event
16
18
  end
17
19
 
18
20
  # Set the event as bubbling.
19
- def bubbles=(value)
20
- `#@native.bubbles = #{value}`
21
- end
21
+ alias_native :bubbles=
22
22
 
23
23
  # Set the event as cancelable.
24
- def cancelable=(value)
25
- `#@native.cancelable = #{value}`
26
- end
24
+ alias_native :cancelable=
27
25
  end
28
26
 
29
27
  module Target