Sha256: caad10417f87d55ba546391866ee564b61c00edea9d9e3880fc855802cff121e

Contents?: true

Size: 850 Bytes

Versions: 4

Compression:

Stored size: 850 Bytes

Contents

require 'glimmer/dsl/static_expression'
require 'glimmer/dsl/web/general_element_expression'

module Glimmer
  module DSL
    module Web
      class StyleExpression < StaticExpression
        include GeneralElementExpression
        include Glimmer
        
        def add_content(parent, keyword, *args, &block)
          if parent.rendered? || parent.skip_content_on_render_blocks?
            return_value = css(&block).to_s
            return_value = super(parent, keyword, *args, &block) if return_value.to_s.empty?
            if return_value.is_a?(String) && parent.dom_element.text.to_s.empty?
              parent.add_text_content(return_value)
            end
            parent.post_add_content
            return_value
          else
            parent.add_content_on_render(&block)
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
glimmer-dsl-web-0.2.4 lib/glimmer/dsl/web/style_expression.rb
glimmer-dsl-web-0.2.3 lib/glimmer/dsl/web/style_expression.rb
glimmer-dsl-web-0.2.2 lib/glimmer/dsl/web/style_expression.rb
glimmer-dsl-web-0.2.0 lib/glimmer/dsl/web/style_expression.rb