Skip to content

Commit

Permalink
Minimize new atoms
Browse files Browse the repository at this point in the history
  • Loading branch information
twalpole committed May 13, 2019
1 parent 74c6b43 commit e3b0a98
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/capybara/selenium/node.rb
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def disabled?
end

def content_editable?
native.attribute('isContentEditable') == "true"
native.attribute('isContentEditable') == 'true'
end

def ==(other)
Expand Down
18 changes: 10 additions & 8 deletions lib/capybara/selenium/patches/atoms.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,18 @@ module CapybaraAtoms
private # rubocop:disable Layout/IndentationWidth

def read_atom(function)
# @atoms ||= Hash.new { |hash, key|
# hash[key] = ::Uglifier.compile(File.read(File.expand_path("../../atoms/#{key}.js", __FILE__)),
# compress: {
# negate_iife: false
# }
# )[0...-1]
# }
@atoms ||= Hash.new do |hash, key|
hash[key] = File.read(File.expand_path("../../atoms/#{key}.js", __FILE__))
hash[key] = ::Uglifier.compile(
File.read(File.expand_path("../../atoms/#{key}.js", __FILE__)),
compress: {
negate_iife: false, # Negate immediately invoked function expressions to avoid extra parens
side_effects: false # Pass false to disable potentially dropping functions marked as "pure"
}
)[0...-1]
end
# @atoms ||= Hash.new do |hash, key|
# hash[key] = File.read(File.expand_path("../../atoms/#{key}.js", __FILE__))
# end
@atoms[function]
end
end
Expand Down

0 comments on commit e3b0a98

Please sign in to comment.