opal-jquery 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/opal/jquery/version.rb +1 -1
- data/opal/opal-jquery/element.rb +10 -3
- data/spec/element_spec.rb +18 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da6d9c3e4bac1b9222cd796fef94c76415fdaaeb
|
4
|
+
data.tar.gz: ef7adcd74505352c5efacaaef72a1ce5ff89033c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49b93286fe4af94808ce543a9cf4006bf7695277b524e569a147ada0569fa870d53f323176d0b78e65f1330e56fd3d9de31e02d275c2056c483eaee24db193df
|
7
|
+
data.tar.gz: 73d24b3bd5d0a792d1c1c2c331c205c3d9b092868b1508b8a063d4b88314da7868f3821f9a4b4f720ccafdd4a7c4c24e9f4002ebaa28a6beb1f259b4123dc77d
|
data/lib/opal/jquery/version.rb
CHANGED
data/opal/opal-jquery/element.rb
CHANGED
@@ -63,6 +63,7 @@ class Element < `dom_class`
|
|
63
63
|
expose :focus, :find, :next, :siblings, :text, :trigger, :append
|
64
64
|
expose :height, :width, :serialize, :is, :filter, :last, :first
|
65
65
|
expose :wrap, :stop, :clone, :empty
|
66
|
+
expose :get, :attr, :prop
|
66
67
|
|
67
68
|
# We alias some jquery methods to common ruby method names.
|
68
69
|
alias succ next
|
@@ -91,7 +92,7 @@ class Element < `dom_class`
|
|
91
92
|
def to_n
|
92
93
|
self
|
93
94
|
end
|
94
|
-
|
95
|
+
|
95
96
|
def [](name)
|
96
97
|
`self.attr(name) || ""`
|
97
98
|
end
|
@@ -210,8 +211,14 @@ class Element < `dom_class`
|
|
210
211
|
`self.length ? self.first() : nil`
|
211
212
|
end
|
212
213
|
|
213
|
-
def html
|
214
|
-
|
214
|
+
def html(content = undefined)
|
215
|
+
%x{
|
216
|
+
if (content != null) {
|
217
|
+
return self.html(content);
|
218
|
+
}
|
219
|
+
|
220
|
+
return self.html() || '';
|
221
|
+
}
|
215
222
|
end
|
216
223
|
|
217
224
|
def id
|
data/spec/element_spec.rb
CHANGED
@@ -184,3 +184,21 @@ describe Element do
|
|
184
184
|
end
|
185
185
|
end
|
186
186
|
end
|
187
|
+
|
188
|
+
describe "Element#html" do
|
189
|
+
html <<-HTML
|
190
|
+
<div id="foo">bar</div>
|
191
|
+
HTML
|
192
|
+
|
193
|
+
it "retrieves the inner html content for the element" do
|
194
|
+
expect(Element.id('foo').html).to include('bar')
|
195
|
+
end
|
196
|
+
|
197
|
+
it "can be used to set inner html of element by passing string" do
|
198
|
+
foo = Element.id 'foo'
|
199
|
+
foo.html "different content"
|
200
|
+
|
201
|
+
expect(foo.html).to_not include('bar')
|
202
|
+
expect(foo.html).to include('different content')
|
203
|
+
end
|
204
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opal-jquery
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Beynon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-12-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opal
|
@@ -115,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
115
|
version: '0'
|
116
116
|
requirements: []
|
117
117
|
rubyforge_project:
|
118
|
-
rubygems_version: 2.
|
118
|
+
rubygems_version: 2.0.3
|
119
119
|
signing_key:
|
120
120
|
specification_version: 4
|
121
121
|
summary: Opal access to jquery
|