diff --git a/lib/phlex/elements.rb b/lib/phlex/elements.rb index e127efdd..3fbec2e3 100644 --- a/lib/phlex/elements.rb +++ b/lib/phlex/elements.rb @@ -42,7 +42,7 @@ def #{method_name}(**attributes, &block) target = @_context.target if attributes.length > 0 # with attributes - if block_given? # with content block + if block # with content block target << "<#{tag}" << (Phlex::ATTRIBUTE_CACHE[respond_to?(:process_attributes) ? (attributes.hash + self.class.hash) : attributes.hash] || __attributes__(**attributes)) << ">" yield_content(&block) target << "" @@ -50,7 +50,7 @@ def #{method_name}(**attributes, &block) target << "<#{tag}" << (Phlex::ATTRIBUTE_CACHE[respond_to?(:process_attributes) ? (attributes.hash + self.class.hash) : attributes.hash] || __attributes__(**attributes)) << ">" end else # without attributes - if block_given? # with content block + if block # with content block target << "<#{tag}>" yield_content(&block) target << ""