motion-prime/elements/base_element.rb in motion-prime-0.4.5 vs motion-prime/elements/base_element.rb in motion-prime-0.5.0

- old
+ new

@@ -26,14 +26,14 @@ @name = options[:name] @block = options[:block] @view_name = self.class_name_without_kvo.demodulize.underscore.gsub(/(_draw)?_element/, '') end - # def dealloc - # pp 'deallocating elemenet', self.name, self.to_s, section.to_s - # super - # end + def dealloc + # pp 'deallocating elemenet', self.name, self.to_s, view_class, view.try(:to_s) + super + end def add_target(target = nil, action = 'on_click:', event = :touch) return false unless self.view self.view.addTarget(target || section, action: action, forControlEvents: event.uicontrolevent) end @@ -151,10 +151,11 @@ @styles += Array.wrap(specific_base_common_suffix_styles) # form element: user_form_field_input, user_form_string_field_input, user_form_field_email_input # table element: categories_table_cell_icon, categories_table_title_icon @styles += build_styles_chain(base_styles[:specific], suffixes[:specific]) end - if section && section.name.present? && name.present? + # don't use present? here, it's slower, while this method should be very fast + if section && section.name && section.name != '' && name && name != '' # using for base sections @styles << [section.name, name].join('_').to_sym end # custom style (from options or block options), using for TableViews as well custom_styles = style_sources.map do |source| \ No newline at end of file