Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: opal/opal-browser
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 5389df75ff9d
Choose a base ref
...
head repository: opal/opal-browser
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 1b758e44d723
Choose a head ref
  • 3 commits
  • 4 files changed
  • 1 contributor

Commits on Jan 25, 2014

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    af84395 View commit details
  2. Copy the full SHA
    bb87b1b View commit details
  3. Copy the full SHA
    1b758e4 View commit details
Showing with 29 additions and 9 deletions.
  1. +1 −0 opal/browser/compatibility/dom.rb
  2. +4 −3 opal/browser/dom/node.rb
  3. +12 −6 opal/browser/support.rb
  4. +12 −0 spec/dom/node_spec.rb
1 change: 1 addition & 0 deletions opal/browser/compatibility/dom.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
require 'browser/compatibility/dom/node'
require 'browser/compatibility/dom/document'
require 'browser/compatibility/dom/element'
require 'browser/compatibility/dom/event'
7 changes: 4 additions & 3 deletions opal/browser/dom/node.rb
Original file line number Diff line number Diff line change
@@ -165,12 +165,14 @@ def clear

# @!attribute content
# @return [String] the inner text content of the node
#
# @abstract
def content
`#@native.textContent`
raise NotImplementedError, 'text content unsupported'
end

def content=(value)
`#@native.textContent = #{value}`
raise NotImplementedError, 'text content unsupported'
end

def blank?
@@ -251,7 +253,6 @@ def inner_html=(value)
end

alias inner_text content

alias inner_text= content=

# @!attribute [r] last_element_child
18 changes: 12 additions & 6 deletions opal/browser/support.rb
Original file line number Diff line number Diff line change
@@ -128,22 +128,22 @@ def self.supports?(base, *extra)
defined?(`document.createEventObject`)

when :addListener
defined?(`document.documentElement.addEventListener`)
defined?(`document.addEventListener`)

when :attach
defined?(`document.documentElement.attachEvent`)
defined?(`document.attachEvent`)

when :removeListener
defined?(`document.documentElement.removeEventListener`)
defined?(`document.removeEventListener`)

when :detach
defined?(`document.documentElement.detachEvent`)
defined?(`document.detachEvent`)

when :dispatch
defined?(`document.documentElement.dispatchEvent`)
defined?(`document.dispatchEvent`)

when :fire
defined?(`document.documentElement.fireEvent`)
defined?(`document.fireEvent`)
end

when :document
@@ -169,6 +169,12 @@ def self.supports?(base, *extra)
when :scrollTop
defined?(`document.documentElement.scrollTop`)

when :textContent
defined?(`document.documentElement.textContent`)

when :innerText
defined?(`document.documentElement.innerText`)

when :matches
case extra.shift
when nil
12 changes: 12 additions & 0 deletions spec/dom/node_spec.rb
Original file line number Diff line number Diff line change
@@ -75,8 +75,11 @@
describe '#next' do
html <<-HTML
<div id="spec-1"></div>
a
<div id="spec-2"></div>
b
<div id="spec-3"></div>
c
HTML

it 'should return the next sibling' do
@@ -93,8 +96,11 @@
describe '#next_element' do
html <<-HTML
<div id="spec-1"></div>
a
<div id="spec-2"></div>
b
<div id="spec-3"></div>
c
HTML

it 'should return the next element sibling' do
@@ -109,8 +115,11 @@

describe '#previous' do
html <<-HTML
a
<div id="spec-1"></div>
b
<div id="spec-2"></div>
c
<div id="spec-3"></div>
HTML

@@ -127,8 +136,11 @@

describe '#previous_element' do
html <<-HTML
a
<div id="spec-1"></div>
b
<div id="spec-2"></div>
c
<div id="spec-3"></div>
HTML