excemel 1.0.1-java → 1.0.2-java
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -1
- data/lib/excemel/excemel.rb +9 -3
- metadata +1 -1
data/History.txt
CHANGED
data/lib/excemel/excemel.rb
CHANGED
@@ -257,12 +257,18 @@ module Excemel
|
|
257
257
|
private
|
258
258
|
|
259
259
|
# Adds attributes to the given Element (tag) as define by the parameter
|
260
|
-
# target
|
260
|
+
# target, passing an attribute with a value of nil, removes the attribute if
|
261
|
+
# it exists
|
261
262
|
def _add_attributes(target, attrs)
|
262
263
|
if attrs
|
263
264
|
attrs.each do |key, value|
|
264
|
-
|
265
|
-
|
265
|
+
unless value.nil?
|
266
|
+
attribute = XOM::Attribute.new(key.to_s, value.to_s)
|
267
|
+
target.add_attribute(attribute)
|
268
|
+
else
|
269
|
+
attribute = target.get_attribute(key.to_s)
|
270
|
+
target.remove_attribute(attribute) if attribute
|
271
|
+
end
|
266
272
|
end
|
267
273
|
end
|
268
274
|
end
|